Chapter 16. Ajax

The term Ajax was first used in early 2005 by Jesse James Garrett as an acronym for Asynchronous JavaScript and XML. The term is a little misleading because (a) the technique is not always asynchronous; (b) XML is not necessarily used; and (c) if you're happy for your code to be Internet Explorer-specific, then you can replace JavaScript with VBScript.

The crux of Ajax, though, is making requests behind the scenes in a web application and incorporating any data returned in the page without reloading the entire HTML. The normal way that this is carried out is by using an HTTP Request controlled by client-side scripting. Data is passed in the request, often as XML, and a response, also commonly XML, is received. The information contained in this response is then incorporated in the page using dynamic HTML.

These techniques have made possible the kind of responsiveness and functionality that previously were only to be found in desktop applications. Two of the most famous Ajax uses both originate from Google. Google Suggest, www.google.com/webhp?complete=1&hl=en, enables a textbox to suggest suitable entries chosen from a drop-down list; and Gmail, mail.google.com/mail/help/intl/en/about.html, is a web e-mail client with almost as much functionality as a traditional desktop application such as Microsoft's Outlook Express.

This chapter first describes previous endeavors to improve the user experience before the Ajax technique was formalized. You will learn the differences ...

Get Beginning XML, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.