jqXHR is a jQuery object that provides a JavaScript cross-browser-compatible superset (wrapper) object for the browser-implemented XMLHttpRequest (XHR) object.
The jQuery XMLHttpRequest object (jqXHR in short) is returned by jQuery's $.ajax()
method and as of jQuery 1.5, it is a superset of the browser's native XMLHttpRequest
object. Among several properties and methods, it contains responseText
, responseXML
, and the getResponseHeader()
method.
Example:
// send an AJAX request as usual
$.ajax('data.php'))
.done(function() {
// the AJAX request was successful
console.log('$.ajax succeeded');
})
.fail(function() {
// the AJAX request was unsuccessful
console.log('$.ajax failed');
})
.always(function() {
// from jQuery 1.6, this function will always be called
// either the AJAX request was successful or unsuccessful
console.log('$.ajax either succeeded or failed');
});