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 6364565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:10:50+00:00 2026-05-25T00:10:50+00:00

Happy coding weekend to everyone!!!. I’m stuck trying to send a JSON object via

  • 0

Happy coding weekend to everyone!!!.

I’m stuck trying to send a JSON object via $.load() of jQuery, i want to send it with the GET method, this is the code that i have in my javascript code, I attached the Ajax request that receives the JSON Object for clarity:

function ajaxLoadClasses() {
    $.ajax({
        url: 'load_classes/',
        type: 'GET',
        dataType: 'json',
        success: function(json) {
            $.each(json, function(iterator,item) {
                              loadViaGet(item);
            });
        },
        error: function(xhr, status) {
            alert('Sorry, there was a problem!');
        },
        complete: function(xhr, status) {},
    });
}


function loadViaGet(item) {
    $div = $('div.myClass');
    //Here is where I'm stuck, I'm not sure if this is the way to send the JSON obj
    $div.load('thisAppURL/?json=' + encodeURIComponent(item), function() { 
        alert('Load was performed');
    });
}

The “item” json obj received was made out of a Model of Django using

jsonToSendToAjax = serializers.serialize('json', obj)

And I don’t think that I’m using the correct methods in my Django to deserialize the JSON object or to convert the JSON object into a Python object so I can handle it in my view and send it to a template:

def popUpForm(request):
    jsonData = request.GET['json']

    deser = serializers.deserialize('json', jsonData)

    #This could be another way to convert the JSON object to a Python Object
    #pythonObj = simplejson.loads(jsonData)

    return render_to_response('class_pop_up_form.html', deser)

It will be very helpful if someone can help me with this!! I’m really struggling with it but I don’t find the right way to do it.

EDIT 1 :
I want to send the JSON object via the GET with the $.load() function, not with the POST method,as I read in the jQuery api: http://api.jquery.com/load/ the $.load() method works as follow: .load( url, [data], [complete(responseText, textStatus, XMLHttpRequest)] )

The POST method is used if data is provided as an object; otherwise, GET is assumed.

EDIT 2:
Forget about sending the json object via the GET method, now I’m using the POST method, but now I don’t figure out how to use that json object in my Django View.py, don’t know if i need to deserialize it or not, the format of the json object that I’m using is the following:

{"pk": 1,
"model": "skedified.class",
"fields": {
      "hr_three": null,
      "group": 1,
      "name": "Abastecimiento de agua",
      "day_three": null,
      "day_one": "1 , 3",
      "hr_one": "10+/3",
      "online_class": null,
      "teacher_name": "Enrique C\\u00e1zares Rivera /   ",
      "day_two": null,
      "class_key": "CV3009",
      "hr_two": null }
}
  • 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-25T00:10:50+00:00Added an answer on May 25, 2026 at 12:10 am

    This isn’t how jQuery suggests you should send the data and it’s probably not a good idea to do it this way either. Your url gets very ugly and long very quick if you add the json string to it like that.

    Use the second argument for $.load; “data” (see http://api.jquery.com/load/) instead. So something like

    $div.load('thisAppURL', {"json": encodeURIComponent(item)});
    

    Also, if you want to trace the output, I’d sugest using the third argument, the callback function, and use console instead of alert. You can get the actual return from the server that way too. So you’d get something like:

    $div.load(
      'thisAppURL',
      {"json": encodeURIComponent(item)},
      function(response, status, xhr){
        console.log(response);
      }
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I do all my coding in vim and am quite happy with it (so,
I am a happy BASH user. I do not want to switch to another
Possible Duplicate: What IDE to use for Python? I want to get serious with
I am a happy user of ESS for coding and debugging R code. I
I have recently started coding in php again and am learning Object Orientated PHP.
I'm more than happy coding apps. I am, however, rubbish at icon design. I'm
Happy New Year. I have a bunch of SOAP Web Services. They all have
I am quite happy to code out tables by hand when making a database
I'm not happy with the rendering of HTML by Swing's JEditorPane. In particular bullets
Say a client is happy with the work you've done creating a script to

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.