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
0
votes
2 answers

Get an object property

Here I have a problem for get and use the properties of an object, I don't understand why I'm stuck on the last few days ... I made a screenshot which may have see the list of properties and methods of the object. In this case I would go to the…
moDevsome
  • 189
  • 2
  • 16
0
votes
1 answer

Return a descriptive error message with my HTTP 500 Internal Sever Error

I'm trying to return a useful error message to my AJAX requests that I can use client side to display to the user. I'm making my requests using jQuery like the following: $.ajax({ url: 'myURL.php', data: { id: someId }, type: 'POST', …
Jon Rubins
  • 4,323
  • 9
  • 32
  • 51
0
votes
1 answer

AJAX XHR-Call creates invalid argument exception

So i try to get a value from a async-task (is not shown here because its not relevant i think and it works) into a progressbar over a Jquery-xhr request. The serverside methode is not relevant because its working, and the jquery-xhr-call works also…
DatRid
  • 1,169
  • 2
  • 21
  • 46
0
votes
0 answers

jQuery Ajax Prefilter cant modify jqXHR object attributes like responseJSON

Im trying to use jQuery.ajaxPrefilter API to make a HTTP Ajax interceptor. Here is the jsFiddle As you can see, I have access to the jqXHR object in the prefilter function, I can even console.log the entire jqXHR object, but some attributes, like…
franleplant
  • 629
  • 1
  • 7
  • 17
0
votes
1 answer

Backbone.js fetch GET with data

I have a REST server that takes a query string in the request body of a GET statement. It's similar to the Parse REST api that does the same. As seen in the curl statement below. curl -X GET \ -H "X-Parse-Application-Id: ${APPLICATION_ID}" \ -H…
Gabe Rainbow
  • 3,658
  • 4
  • 32
  • 42
0
votes
1 answer

adding attributes to XHR callback function

I feel like maybe if I knew what to call the first attribute of xhr.addEventListener (????) this could work, var string= "I wan't to be sent as an attribute"; var xhr = new XMLHttpRequest() xhr.addEventListener("load", uploadComplete(????, string),…
coiso
  • 7,151
  • 12
  • 44
  • 63
0
votes
1 answer

adding results of XML request to a page

I am trying to get a feel for adding content to a page with XMLHTTPRequest. I would like to add the results to existing page content say in a second column, but I am not having any luck. I would appreciate a shove in the right direction. Thanks…
MJMacarty
  • 537
  • 7
  • 17
0
votes
1 answer

Javascript XMLHttpRequest.sendAsBinary() support in Chrome

I need the sendAsBinary() function in javascript, but it seems that Chrome has removed it natively. On the Mozilla MDN (https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest), they provide a custom function which extends the XMLHttpRequest…
Justin
  • 42,716
  • 77
  • 201
  • 296
0
votes
1 answer

Incorrect jqXHR response for Jquery Forms Plugin in IE8 and 9

I've got an unusual problem that I've only been able to replicate in IE8 and 9 - I've tested Safari, Chrome (both on a Mac, Firefox (on a PC) and IE8, 9 and 10. I have the following code: $('#fileStore_newUpload').ajaxForm({ beforeSubmit:…
jamesk5
  • 136
  • 3
  • 13
0
votes
2 answers

How can I access/read jqXHR fields from my program

I have a code that calls execution of a remote code. Upon successful completion, I need to save the total time it took (the same time value that is shown in chrome developers console). The part of my ajax call is: function callJSON(){ $.ajax({ …
Espanta
  • 1,080
  • 1
  • 17
  • 27
0
votes
2 answers

asp.net MVC / jQuery Ajax returning 500 Exception not JSON Result

I have a asp.net MVC 2 web application in all Middle Tier Controller Actions I catch all exceptions, Log, and then rethrows the Exception. This rethrow is picked up by the JQuery Ajax error handler throw new Exception(e.Message); I am making an…
user327999
  • 443
  • 1
  • 9
  • 21
0
votes
3 answers

Variable scope with deferred / ajax in jQuery

I'm using pretty standard setup I think. A click on element to call a function that handles an ajax request. My limited understanding of variable scope and callbacks when using asynchronous anything and trying to figure out jQuery deferreds is…
tim
  • 3,823
  • 5
  • 34
  • 39
0
votes
2 answers

Need to access the xhr object when I call backbone fetch

I need to access the xhr object when I call Backbone fetch. My understanding from the docs is that all Backbone.sync methods return a jqXHR object. However, when I do this... var xhr = this.collection.fetch(); console.log( xhr ); ...xhr is coming…
user1031947
  • 6,294
  • 16
  • 55
  • 88
0
votes
0 answers

jquery file upload error: has no method 'abort'

I'm trying to implement cancel action for file upload plugin and have some issue with aborting jqXHR request. $('#filedd').fileupload({ dataType: 'json', url: "", progress: function (e, data) {}, add: function(e,…
Anton Igonin
  • 283
  • 2
  • 11
0
votes
1 answer

Prevent jQuery.ajax() from sending automatically

I need to do some (potentially asynchronous) stuff before sending an AJAX-request via jQuery. Is there any way to evoke the sending of the request on a jqXHR object manually? The problem is that I need to immediately return the jqXHR object (e.g. to…
Leo Selig
  • 1,062
  • 1
  • 16
  • 30
1 2 3
11
12