Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

CHAPTER 15: Using Ajax: Part II > Understanding the jqXHR Object - Pg. 432

CHAPTER 15 USING AJAX: PART II shorthand methods. By default, the ajax method makes an HTTP get request, which means that the example is equivalent to using the get or getJSON method, which I showed you in Chapter 14. I'll show you how to configure POST requests later in this chapter. Lots of settings are available, and I explain them throughout the rest of the chapters, in addition to some useful methods that jQuery provides to make using Ajax easier. Understanding the jqXHR Object The result of the ajax method is a jqXHR object, which you can use to get details about the request and interact with it. The jqXHR is a superset of the XMLHttpRequest object that underpins browser support for Ajax and has been adapted to work with the jQuery deferred object features that I describe in Chapter 35. For most Ajax operations, you can simply ignore the jqXHR object, which is exactly what I suggest you do. The jqXHR object is useful when you need more information about the response from the server than would otherwise be available. You can also use the jqXHR object to configure the Ajax request, but this is more easily done using the settings for the ajax method. Table 15-2 describes the members of the jqXHR object. Table 15-2. The jqXHR Members Member readyState Description Returns the progress of the request through its life cycle from unsent (value 0) to complete (value 4)