Questions tagged [jqxhr]

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');
  });

Resources

Related Tags

177 questions
1
vote
1 answer

Can I get the 'errorThrown' text from a jqXHR object in the complete callback?

The error callback is defined as: Type: Function( jqXHR jqXHR, String textStatus, String errorThrown ) The complete callback is defined as: Type: Function( jqXHR jqXHR, String textStatus ) I'd like to be able to get the errorThrown property from…
Chris Williams
  • 11,647
  • 15
  • 60
  • 97
1
vote
1 answer

javascript done function without ajax call

I want to make a function that supports done but without returning ajax. function checkAndReturn(){ if(global.id){ return global.id; // the problem might be here }else{ return…
Akshay
  • 3,558
  • 4
  • 43
  • 77
1
vote
1 answer

Association between Backbone Collection and XHR object created when fetching

Is there an existing association between a Backbone Collection and the XHR object created when you execute a .fetch() on it? I would like to do something like this: collection = new Backbone.Collection; xhrObj = collection.fetch(); xhrObj.parent ==…
wuliwong
  • 4,238
  • 9
  • 41
  • 69
1
vote
3 answers

Issue with continuously run of getJSON function

I'm trying to print Google last quotes with the code below. The problem is that it prints only 1 quote and it seems like it stops running. What could be a problem here? Thanks Danny