Introduction to AJAX
AJAX basics
AJAX enables a dynamic, asynchronous Web experience without the need for page refreshes. It incorporates the following technologies:
- XHTML and CSS provide a standards-based presentation.
- Document Object Model (DOM) provides dynamic display and interaction.
- XML and XSLT provide data interchange and manipulation.
-
XMLHttpRequest provides asynchronous data retrieval.
- JavaScript binds everything together.
The core of AJAX technology is a JavaScript object: XMLHttpRequest. This object is supplied through browser implementations -- first through Internet Explorer 5.0 and then through Mozilla-compatible browsers. Take a closer at this object.
XMLHttpRequest
With XMLHttpRequest, you can use JavaScript to make a request to the server and process the response without blocking the user. As you create your Web site and use XMLHttpRequest to perform screen updates on the client's browser without the need for refresh, it provides much flexibility and a rich user experience.
Examples of XMLHttpRequest applications include Google's Gmail service, Google's Suggest dynamic lookup interface, and the MapQuest dynamic map interface. In the next sections, we demonstrate how to use XMLHttpRequest object in detail as we demonstrate the design of a book order application and implement it.