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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access