Chapter 11. Ajax Applications as REST Clients
Ajax applications have become very hot during the past couple of years. Significantly hotter, in fact, than even knowing what Ajax applications are. Fortunately, once you understand the themes of this book it’s easy to explain Ajax in those terms. At the risk of seeming old-fashioned, I’d like to present a formal definition of Ajax:
An Ajax application is a web service client that runs inside a web browser.
Does this make sense? Consider two examples widely accepted not to be Ajax applications: a JavaScript form validator and a Flash graphics demo. Both run inside the web browser, but they don’t make programmatic HTTP requests, so they’re not Ajax applications. On the flip side: the standalone clients I wrote in Chapters2 and 3 aren’t Ajax applications because they don’t run inside a web browser.
Now consider Gmail, a site that everyone agrees uses Ajax. If you log into
Gmail you can watch your browser make background requests to the web
service at mail.google.com, and update
the web page you’re seeing with new data. That’s exactly what a web
service client does. The Gmail web service has no public-facing name and
is not intended for use by clients other than the Gmail web page, but it’s
a web service nonetheless. Don’t believe it? There are libraries like
libgmail
that act as unofficial, non-Ajax clients to the Gmail web
service. Remember, if it’s on the Web, it’s a web service.
This chapter covers client programming, and it picks up where ...