Chapter 7AJAX

AJAX is the technology that enables you to make arbitrary HTTP requests from JavaScript to obtain new data without the need for reloading a document. AJAX stands for Asynchronous JavaScript and XML. The name is misleading, though, because you don't have to use XML, and your requests don't have to be asynchronous. You can have synchronous requests (a request that causes your code to pause execution until the answer is received from the server) that are in the JSON format. XML is just one of many possible formats that you can use to transmit data from a server to client-side JavaScript.

Using AJAX you can make web documents behave much less like documents and much more like completely self-contained desktop applications. With a web-based application, updates are much easier to propagate because everyone upgrades immediately upon their next visit to the website. No longer do companies worry about maintaining legacy software and users—with a web-based application, everyone is pushed to the latest version. It also becomes easier for a user to access these applications. Because a separate installation is not required on every computer where the application's use is wanted, all that is required is a capable browser on top of moderately capable hardware. Browsers strive to blur the line between desktop applications and web-based applications even more because browsers such as Firefox and Google's Chrome browser make it easier to make a web-based application available as ...

Get Web Development with jQuery now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.