|
|
Speeding Up AJAX with JSON
|
04/06/2006, By Sean Kelly
|
Over Developer.com Sean Kelly has written an nice article on Speeding up Ajax with JSON, He introduced JSON concept to users and its comparison with similar XML structure etc.
In AJAX, the JavaScript on the page sends requests to a Web server for data while the user's viewing and interacting with the page (hence the "asynchronous" part of AJAX). Those requests are HTTP requests just like the one the browser used to retrieve the page in the first place, as well as any images, stylesheets, and so forth. As such, the XMLHttpRequest object can be used to retrieve any kind of data, not just XML. For example, JavaScript can use XMLHttpRequest to retrieve a plain text file from a Web server and display its contents within a form.
XML is the standard way to interchange data, but it's often not the best way. Although XML can add structure and metadata to data, it does so in an overly verbose way. XML also has a fairly complex syntax, requiring a non-trivial parser to attack it. In JavaScript, XML must be parsed into a DOM tree to be used. And, once you've constructed the DOM tree, you still have to pilot through it to create corresponding JavaScript objects or otherwise use the XML data in your client-side Web application.
Read also Dave Johnson's article titled JSON and the Golden Fleece which discusses JSON and XML, and shows how XML dominates in speed with large data sets.
Read Full Article...
|
Rate this Ajax Articles
Rating: 8.0 out of 2 votes cast
| |
|
|
|
|
|
|
|
|
|
|
|
|