Handling the Response

The TreeManager object is the access point to the component. This object bridges the gap between the Ajax response and the Tree object in the view or the GUI.

TreeManager may be a small object, but it helps to separate the back-end response data from the GUI by adding an extra layer to act as a data controller, which is something we will cover in more detail in Chapter 15, “Model View Controller.”

The display method (see Listing 11.3) first checks to see if the ready state of the Ajax object is successful. After it receives the 'OK' string, it is ready to parse the response from the request. The difference between this controller and the controllers in the other components is that we do not actually parse any data from the ...

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.