Chapter ONLINE SECTION VII. XMLHttpRequest and Ajax

Although blending XML data into an HTML document on the client was possible at least as early as Microsoft Internet Explorer 5—released to the world in August 1999—the concept didn’t blaze across web developers’ radar screens until it gained a catchy acronym in early 2005. That acronym—Ajax—stands for Asynchronous JavaScript and XML, and was coined by Jesse James Garrett.

More specifically, Ajax uses a scriptable object known as the XMLHttpRequest object to request server data (and post client data to a server) as a background process, invisible to the user (except perhaps for evidence of network traffic in modem indicators). As the name of the object implies, it is intended to fetch XML data via the time-tested Hypertext Transfer Protocol. Once an XML document is received by the object, client-side scripts can use Document Object Model properties and methods to examine and copy data, usually with the goal of adding to or replacing HTML document data currently on display. The benefit for the user is that instead of waiting for an entire page to be delivered from the server with only a little bit of updated information, a quick request and tiny bit of data can be sent to the client, where a script updates the HTML in the current document much more quickly and with less visual distraction. Ajax thus becomes one contributor to what is commonly called a Rich Internet Application—one that typically attempts to mimic the behavior and ...

Get Dynamic HTML: The Definitive Reference, 3rd 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.