Chapter 6. Creating the Engine

In Chapter 2, “The Request,” we created a few functions to create an XHR, and handle receiving and displaying a response. This solution works fine in many cases, especially for simple Ajax-based web pages, but it is not the best solution for large web applications. In order to manage multiple requests and delegate responses to specific requesting objects, we will create an Ajax engine. This engine will consist of two objects: Ajax and AjaxUpdater. The AjaxUpdater will manage all requests and delegate them to the Ajax object. The Ajax object will receive the requests from the AjaxUpdater and instantiate an XHR object. After the XHR object has been instantiated and the requesting object receives a response, the requestor ...

Get Ajax for Web Application Developers 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.