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

Aborting All Ajax Calls - jqXHR

Basically im using jqXHR with asmx. I want to do this if its possible; Overally in everypage im using 6-7 ajax calls with sync or async depends on which method it is. But when one of them got error i want to break that ajax call and after the all of…
burakakkor
  • 335
  • 3
  • 12
2
votes
1 answer

Build an XHR link on javascript website for python requests

I'm scraping the following website Scorebing using requests. In order to do so, I'm exploring the website to locate the XHR calls and get an url like this being the code as follows import requests,json header={some data from the XHR I got using…
puppet
  • 707
  • 3
  • 16
  • 33
2
votes
1 answer

XHR upload progress event total different from target.files size?

I'm currently working on a file uploader that will eventually be able to loop through multiple files and tally up the total amount of bytes to upload by looping through them all beforehand. However, I've come across the following problem... If I…
Ken
  • 499
  • 6
  • 18
2
votes
1 answer

JavaScript HTTP request failed

Could anybody take a look at below code help me to figure out what I am doing wrong ? I am getting this error error XMLHttpRequest {readyState: 1, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, responseURL: ""…} when I am…
chen.w
  • 129
  • 1
  • 7
2
votes
1 answer

How to handle multi file upload in Jquery File Upload properly

I have a queue, when a user choose file(s), file(s) will be added to queue, this files may or may not choose at once The problem is, on start uploading, each file open separate XHR connection and separate request, This is not OK for 2 main…
Mojbala
  • 115
  • 1
  • 5
2
votes
1 answer

Amazon S3 direct upload: CORS error

I'm unable to do a direct upload (javascript XHR) on my S3 bucket, because of CORS blocking system. I'm using PHP to generate direct a upload link, with an upload policy and S3 signature: {"key": "501/source/${filename}", "AWSAccessKeyId":…
DrySs
  • 31
  • 1
  • 4
2
votes
1 answer

How to handle 204 response from ajax request in jquery

I'm trying to handle a Status: HTTP/1.1 204 No Content error. I'm using .fail() to handle all other errors, but 204 is not handled by this function. While trying if (jqXHR.status == "204") {alert("error!");}, the alert is not thrown when a 204 is…
Matt
  • 1,239
  • 4
  • 24
  • 53
2
votes
1 answer

Progress Bar not showing properly - Upload files using ajax

for( var i=0; i<=input.length-1; i++ ) { // Append all files in the formData. formData.append( 'files[]', input[i] ); // Create progress element. var progressElement = jQuery( '
  • Hassan Ali
    • 593
    • 1
    • 8
    • 26
  • 2
    votes
    2 answers

    Get more information from a failed JQuery jqXHR request

    I'm using JQuery's $.when and $.get to fetch some data and do something with it. When there is an error fetching it or doing something with it, I want to handle that error, and handle it differently depending on which data I was fetching/at which…
    Isaac
    • 15,783
    • 9
    • 53
    • 76
    2
    votes
    1 answer

    Backbone Model.save returns undefined instead of jqxhr

    EDIT 1: This question is not valid anymore. For more info check EDIT #2 at the end of this question. The backbone docs say that Backbone.Model.save function returns a jqXHR objects if validation is successful, otherwise it returns false. So if a…
    GunnerFan
    • 3,576
    • 3
    • 25
    • 38
    2
    votes
    1 answer

    How to make file upload work with jQuery and xhr2 (empty $_FILES returned)

    I am using the $.ajax method and xhr2 to upload a file using the $.ajax method. When I assing any standard object to the $.ajax parameter data, a proper non empty array is returned in $_POST (php). JS: data : {name:"john doe"} PHP:…
    Vincent
    • 1,651
    • 9
    • 28
    • 54
    2
    votes
    2 answers

    If I have a jQuery jqXHR response object, can I see if it's a response to a POST or to a GET?

    This is basically what the original problem reduces to: I have a Backbone model and I want to execute a certain action every time it saved successfully, but not after it's fetched. The cleanest and least intrusive way to do this, as I see it, would…
    Mihai
    • 2,835
    • 2
    • 28
    • 36
    2
    votes
    1 answer

    Ajax jQuery multiple calls at the same time - long wait for answer and not able to cancel

    My problem is as follows: On a page, I am doing multiple (6) ajax calls (via jQuery) to fetch some data at the same time (using php wrapper to fetch the data via the calls) The requests are made at the same time and it takes them 10-20 seconds to…
    IvanS
    • 47
    • 1
    • 5
    2
    votes
    1 answer

    Unable to abort upload on 'fileuploadchunkdone' event handler for blueimp file upload plugin

    I'm trying to kill the upload as soon as an exception occurs. The "fileuploadchunkdone" event handler allows me to capture the "error" json sent from the server for every single chunk. Ideally, I would like to abort the upload as soon as an…
    TheDude
    • 1,421
    • 4
    • 29
    • 54
    2
    votes
    1 answer

    What does 'rejected' mean for Deffered objects other than jqXHRs?

    From deferred.fail() page : Description: Add handlers to be called when the Deferred object is rejected. and the exmple: $.get("test.php") .done(function(){ alert("$.get succeeded"); }) .fail(function(){ alert("$.get failed!"); }); As we know,…
    egig
    • 4,370
    • 5
    • 29
    • 50
    1 2
    3
    11 12