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

blueimp fileupload - doesn't trigger the progress

I have a very simple upload script, but it doesn't trigger the progress.. It only triggers the progress method once and when the file is done it triggers complete and prints done! Chrome 58.0.3029.110 (64-bit) Firefox 53.0.3 (32-bit) Have also…
clarkk
  • 27,151
  • 72
  • 200
  • 340
1
vote
0 answers

XMLHttpRequest cannot load " " No 'Access-Control-Allow-Origin' Origin not allowed access. Key Set-cookie

I want to Show an HLS Live stream on my site, but I'm getting "XMLHttpRequest cannot load "Link".m3u8.key. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'My site' is therefore not allowed access. The response…
1
vote
0 answers

jquery ajax progress bar when content length equals to 0

I try to use jQuery AJAX for my goal but I have a problem. $('#go').on('click',function(evt){ evt.preventDefault(); $(this).hide(); $('#progress-bar').show(); console.log('starting ajax request'); $.ajax({ xhr:…
Dmitry Shulga
  • 588
  • 1
  • 6
  • 19
1
vote
0 answers

ajax request return code 400, bad request

hey i have a ajax request like $.ajax({ type: 'GET', url: 'http://solr.plunq.id:8984/solr/'+ url_Category +'/select', data: {q: "*:*", start: offset, rows: limit, wt: 'json', indent:'true',…
cahyowhy
  • 553
  • 2
  • 9
  • 26
1
vote
0 answers

XHR upload progress going from 100% back to 50%

When monitoring XHR file upload progress in Safari 9.1 (Chrome and Firefox do fine) using jQuery $.ajax(), loaded starts from 0 and total from the file size. However, in some cases, when the upload finishes, total suddenly doubles and loaded…
Ricardo
  • 180
  • 2
  • 12
1
vote
1 answer

How to trick a jqXHR to resolve using local data?

This is similar to this question Make jquery jqxhr act like already sending request but that doesn't seem to solve my problem. I'm using a framework where there are lots of requests done using jQuery ajax methods, and I have to hook in the middle of…
AlfonsoML
  • 12,634
  • 2
  • 46
  • 53
1
vote
1 answer

Edge triggers fail when an XmlHttpRequest is aborted

I was testing a tool that fires some asynchronous ajax requests. The response of one request can abort another one. This works great as far as I have tested this (Chrome, Firefox) but Edge doesn't like aborting! As soon as the XmlHttpRequest is…
Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
1
vote
1 answer

Is it possible to use xhr for local files?

I can't find any recent answers to this, is it possible to load up a local file using AJAX request. So in my site I have a file called data.json on my web server is it possible to request the date from my Js file using a relative path rather than…
Sam Mason
  • 1,037
  • 1
  • 8
  • 29
1
vote
0 answers

How to retrieve data, when jqxhr get 304 response

I am creating an ajax request, where I get some data returned from server with 200 OK response code. The request header uses if-modified-since to get a 304. My question is that when there is a 304 response, the data is not available in jqxhr…
Gr. Mish
  • 31
  • 3
1
vote
0 answers

Existing method for keypress/xhr/timeout

I'm looking to a jQuery/javascript method for doing theses 2 functionnalities in one unique event : an abort of an XHR query when a new one is sent a timeout to avoid a lot of queries at each keypress $('#myElement').on('input propertychange',…
pierallard
  • 3,326
  • 3
  • 21
  • 48
1
vote
0 answers

Javascript fails to fetch Json data from url

I am trying to fetch json data from my server using Javascript, and I followed the solution provided here. But It doesn't work for me. And I found out that xhr.onload = function() not run in my case. How to figure it out?
Zheng
  • 77
  • 1
  • 11
1
vote
1 answer

How to read a property from a JSON response when the HTTP response has a failure code?

I have this code: $.post(Routing.generate('parMarcaModelo'), { "marcaId": currBranch, "modeloId": currModel, "marcaNombre": currBranchName, "modeloNombre": currModelName }, 'json').done(function (data, textStatus, jqXHR) { // do…
ReynierPM
  • 17,594
  • 53
  • 193
  • 363
1
vote
2 answers

jqXHR vs. jQuery AJAX-requests in Rails

I don't understand why this jQuery.AJAX-request to a .csv-file fails to display a Highchart chart in Rails: var jQuery = $.get('foo.csv', function(data) {} whereas this one displays just fine: var jqxhr = $.get('foo.csv', function(data) {} Can…
ljnissen
  • 139
  • 1
  • 12
1
vote
1 answer

How to access properties of returned jQuery jqxhr object if returned from sucess()

This seems like the most bizarre thing: var mah_dataz = $.get("link/to/request"); console.log(mah_dataz); /* result is the whole shebang: Object { abort: function (a){var b=a||u;return d&&d.abort(b),c(0,b),this} always: function…
Jonline
  • 1,677
  • 2
  • 22
  • 53
1
vote
1 answer

Drag&drop files uploads via jQuery AJAX are strangely limited by filesize

I've have been coding files uploads via jQuery AJAX. Everything worked fine unitl I was trying to upload files approximately greater 4 MB. What am I missing? Fact are following: php.ini - checked (max upload file size, max execution time…
Daniel.P.
  • 480
  • 2
  • 8
  • 19