views:

63

answers:

3

For a data send, where the return data contains potential updates for hundreds of elements on a page, is XML or JSON or another data format better, for usage with jQuery's various parsing formats (invoked via ajax() success)?

+1  A: 

It sounds like a lot of data being returned so json. It's lighter and more compact. Plus it has native use instead of having to parse the xml and traverse it afterwards.

spinon
+3  A: 

Check out this article, it outlines various pros/cons of XML, JSON and HTML when processing AJAX requests.

Personally I'd pick JSON as it uses less bandwidth & is easier to parse and use.

Joseph Paterson
I usually use JSON by default, but thought to take a breather to see if I might be able to speed up clientside data loading for this project. I had thought both XML and JSON were native formats, but I guess JSON is still the way to go!
ina
+1  A: 

In javascript it is better to go with JSON because it is easier to code and less data to load from the server, unlike XML you have to write a code to parse the elements and fetch the values to your object and for every change in data tags or elements in XML you will need to modify your javascript code which means more coding and testing, unlike JSON all what you need is eval() and you are ready to go.

Kronass