Using jQuery .load to get a web page and XML data

Is it possible to use a .load or a .post or some other method to send a request to the server to update a page based on passed data and to return the updated html section and also to return an XML data structure back to the callback function in the .load method?

I would assume at that point the load would load the #div section of the document to the target. If it is possible to send XML data also, how would I structure that and how would I send it and access it in jQuery or javascript?

What I want to do is update one section of the page with new html and then make some changes to another section using jQuery or javascript based on the XML data. Both changes are based on the data passed in the initial .load request so having to do it twice is redundant.

The data you receive from the server can be as a JSON object, so that you can store different types of data within that JSON object, and interpret it once it gets to the web page.

Again, thanks. Today is a study day. :slight_smile:

You cannot use jQuery.load() with JSON, because .load is designed to load the retrieved data as HTML on to the page.

The last example on the jQuery.post() page shows you how to do it for JSON

Excellent, I’ve never used JSON before but it sounds like it’s time to learn.

In this situation, is it better to use .load or .post since all the interpretation will be done by the callback function, correct? Or is there another method that suits this better?

Thanks for the input.