Chapter 11. AJAX (and Related Topics)


AJAX has generated a huge buzz since the term was coined in February 2005. And although there is a lot of (justified) criticism, regarding both the term and the technology mix it is promising, the whole hype around AJAX led to the rebirth of JavaScript. Not only are underestimated capabilities of JavaScript carried into the daily work of web developers, but more advanced JavaScript features also are en vogue again. This chapter presents not only the most important facts (and phrases) regarding JavaScript, but also related technologies, especially XML handling with JavaScript.

Understanding AJAX

Back in the 1990s, Microsoft added a new ActiveX object to its Internet Explorer web browser (version 5.0): XMLHttpRequest. This object was capable of sending HTTP requests to a server and evaluating the data returned from that, quite similar to the Web Services concept (but using another approach called RESTRepresentation State Transfer). This came by the request of the Outlook team that worked on the latest version of the web front-end for their software.

A few years later, this object was discovered by developers of the Mozilla project, and they decided to create their own version of XMLHttpRequestof course, as a native JavaScript object, since ActiveX does not work cross-platform. Also, the Safari developers implemented XMLHttpRequest. Since the browser was based on the KHTML rendering engine of Konqueror, the code (donated by Apple) could also be applied to the KDE browser. Finally, the Opera and iCab browsers also added support for XMLHttpRequest.

While more and more web applications were using XMLHttpRequest, Jesse James Garrett wrote an article in February 2005 called "Ajax: A New Approach to Web Applications" (available online at http://www.adaptivepath.com/publications/essays/archives/000385.php). In this article, he coined the term "AJAX," which stands for "Asynchronous JavaScript + XML." He argued that his company was using XMLHttpRequest and JavaScript and DOM and XML and XSLT and XHTML and CSS, and it was getting more and more difficult to explain this to clients, especially if they were not technical people. Therefore, the term was invented, although this led to quite some criticism (for instance, no XML is required for AJAX). But still the coining of the term "AJAX" was the tipping point for the technology; from then on, it really took off.

From a technical point of view, AJAX is really all about using XMLHttpRequest to send HTTP requests to the web server (which must be in the same domain as the script, for security reasons) and using JavaScript to evaluate and display the data on the client. There is nothing more to it, but still there are even dedicated conferences for AJAX.





JavaScript Phrasebook(c) Essential Code and Commands
JavaScript Phrasebook
ISBN: 0672328801
EAN: 2147483647
Year: 2006
Pages: 178

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net