Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 989851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:51:28+00:00 2026-05-16T05:51:28+00:00

This is my ajax function: function ajax_call(call_method,data_to_send) { logger(function ajax_call. var data_to_send: ); logger(data_to_send);

  • 0

This is my ajax function:

function ajax_call(call_method,data_to_send) {
    logger("function ajax_call. var data_to_send: ");
    logger(data_to_send);
    $('.clickable save_button').hide()
    $.ajax({
      type: 'POST',
      url: call_method,
      data: data_to_send,
      success: function(data){
            logger("data returned to page after ajax call: ");
            logger(data);
            $('.error_msg').html("Successfully saved record to database.");
            $('.error_msg').fadeIn('slow');
            setTimeout("$('.error_msg').fadeOut('slow');",5000); // 5 secs to give user enough time to read
            $('.clickable save_button').show()
            response_dispatcher(data); // This should contain object type at least
      },
      failure: function(){
            $('.error_msg').html("There was an error while saving this information. Please try again. " +
                                    "If the error persists, please contact us using the contact form.");
            $('.error_msg').show;
            $('.clickable save_button').show()
      },
      dataType: 'json'
    });
}

And, this is the data sent to my method on the backend:
{
‘display_order’:”3″,
‘goal’:”dummy goal”,
‘id’:-1,
‘object_type’:”goal”
}

I’ve verified within my application that this same data is received.

Here is my Django view method:

@login_required
def update_goal_view(request):

    if request.method == 'POST' and request.is_ajax:
        # Example data sent from AJAX Request
        #qd = {u'display_order': [u'23'], u'object_type': [u'goal'], u'goal': [u'dummy goal'], u'id': [u'-1']}
        qd = request.POST
        goal = qd.get('goal','')
        display_order = qd.get('display_order',99999)
        id = int(qd.get('id',''))
        object_type = qd.get('object_type','')

    # For now, just return something to test populating data to the page
    id = '100'
    goal = 'goal returned'
    object_type = object_type
    data = {'id':id,'goal':goal,'object_type':object_type}
    return HttpResponse(data,mimetype="application/json")

In Firebug, I see this after the ajax call:

POST http://127.0.0.1/xml/update_goal 200 OK 12ms

The issue is, when that it appears that my success callback is never called… I say that because as you can see from above, I there should be a message written to my logger but there isn’t one. I know my logger works because of all the other messages outside of the callback that do get written to my logger.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:51:29+00:00Added an answer on May 16, 2026 at 5:51 am

    I don’t think Django does automatic serialization for dictionaries. You’ll have to serialize them to JSON by hand.

    import simplejson
    
    # ...
    
    return HttpResponse(simplejson.dumps(data), mimetype="application/json")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jQuery AJAX call with type:'GET' like this: $.ajax({type:'GET',url:'/createUser',data:userId=12345&userName=test, success:function(data){ alert('successful'); }
I have a jQuery AJAX function like this: $.ajax({ url: 'crud/clients.php', dataType: 'json', type:
I have an issue I have this jQuery code: $(document).ready(function(){ $(#follow).click(function(){ $.ajax({ type: 'POST',
I have this piece of JS: $('.self_delete').live('click', function(e){ e.preventDefault(); $.ajax({ type: 'DELETE', url: $(this).attr('href'),
I am making ajax call like this $(document).ready(function() { var abc = new Array();
How to pass multiple checkboxes using jQuery ajax post this is the ajax function
I'm trying to make this call to send data to the server: $.ajax({ type:
I'm having hard time with this simple ajax call function sendreq() { $.ajax({ dataType:
I am trying to do the following: function main(callback) { $.ajax('server-side', function() { this.callback.call(hello);
I need help with one ajax function This is raw page setup. Page will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.