Chapter 8. Talk to the server with Ajax

 

This chapter covers

  • A brief overview of Ajax
  • Loading pre-formatted HTML from the server
  • Making general GET and POST requests
  • Making requests with fine-grained control
  • Setting default Ajax properties
  • A comprehensive example

It can be successfully argued that no one technology has transformed the landscape of the web more in recent years than the adoption of Ajax. The ability to make asynchronous requests back to the server without the need to reload pages has enabled a whole new set of user interaction paradigms and made Rich Internet Applications possible.

Ajax is a less recent addition to the web toolbox than many people may realize. In 1998, Microsoft introduced the ability to perform asynchronous requests under script control (discounting the use of <iframe> elements for such activity) as an ActiveX control to enable the creation of Outlook Web Access (OWA). Although OWA was a moderate success, few people seemed to take notice of the underlying technology.

A few years passed, and a handful of events launched Ajax into the collective consciousness of the web development community. The non-Microsoft browsers implemented a standardized version of the technology as the XMLHttpRequest (XHR) object; Google began using XHR; and, in 2005, Jesse James Garrett of Adaptive Path coined the term Ajax (for Asynchronous JavaScript and XML).

8.1. Brushing up on Ajax

8.2. Loading content into elements

8.3. Making GET and POST requests

8.4. Taking full control of an Ajax request

8.5. Putting it all together

8.6. Summary

sitemap