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
1 answer

PHP ajax multiple calls

I have been looking for several answers around the web and here, but I could not find one that solved my problem. I am making several JQuery ajax calls to the same PHP script. In a first place, I was seeing each call beeing executed only after the…
ThomasLC
  • 5
  • 3
0
votes
1 answer

AJAX doesn't seem to be working

When i click on the button to submit my form using the ajax code below, nothing happens, none of the alerts are triggered to tell me if there is an error or a success and so i am not sure how to know what is happening, no matter what i try i can not…
Stan Williams
  • 263
  • 3
  • 14
0
votes
1 answer

Find resultant of two asynchronous ajax request in xhr onprogress

I am trying to find images in ajax request response text and fetch the src url for using in another ajax request. I need to know progress of loading each image and show the resultant of this progress in my progress bar. But as you can see if image1…
Amir Rezvani
  • 1,262
  • 11
  • 34
0
votes
1 answer

How do I deal with ' Cross Origin Request Blocked ' while parsing JSON file from any URL which containing JSON form data?

I am trying to integrate my code which is written in Backbone js with REST service which is placed on some different server. But when I am hitting the web service from my local machine console window of browser displays CORS blocked.
Rajat Badjatya
  • 760
  • 6
  • 13
0
votes
0 answers

Calling $http.get() multiple times always returns cached result

I have an angular controller that makes repeated gets via the $http object, like this: $scope.refresh = function() { let url = 'api/get-status'; $http.get( url ).then( function( response ) { console.log( response.data ); …
Rafael Baptista
  • 11,181
  • 5
  • 39
  • 59
0
votes
0 answers

How to get "textStatus" with jQuery .ajaxError()?

If I handle jQuery AJAX errors using fail(), I can use textStatus to provide a nice error message to the user: $.get("/some_script.php") .done(function() { // It works! }) .fail(function(jqXHR, textStatus, errorThrown) { switch(textStatus) …
Marcovecchio
  • 1,322
  • 9
  • 19
0
votes
1 answer

Handling callbacks within a loop

I need to make n AJAX calls in a loop and store result in an array. When all requests are finished, and the array is full of returned JSON data, I want to loop through that to check it. There are two problems here: 1) how do I make jqxhr available…
user3871
  • 12,432
  • 33
  • 128
  • 268
0
votes
1 answer

FormData file, ajax doesn't post $_FILES in IE 11

I have the following code (formdata) in JavaScript and it's working properly in Mozilla and Chrome. When I tried it in IE 11, it doesn't POST well using ajax. The success function is called, but $_FILES is empty on the server side. file =…
0
votes
1 answer

How to return data in jQuery Ajax?

let's say i have a simple function: function test(url){ var AjaxCall = $.ajax({ type: GET, url: url, data: {}, success: function(data,status,xhr){ return xhr }, error:…
Abude
  • 2,112
  • 7
  • 35
  • 58
0
votes
1 answer

Why does the jquery ajax documentation mean when it says "For backward compatibility with XMLHttpRequest"

I'm looking at the documentation for the current version (1.11.2) of jQuery's ajax method. It prefaces the explanation of the jqXHR object with the following line: For backward compatibility with XMLHttpRequest, a jqXHR object will expose the…
alexw
  • 8,468
  • 6
  • 54
  • 86
0
votes
0 answers

Maatwebsite/Excel fails on import with Laravel 4.2

I'm writing a web-app to parse Excel files, each contains a lot of data (~47 columns and thousands of rows). The framework is Laravel 4.2 and the package used is laravel-excel (maatwebsite/excel). When I wrote all the code, I had a sample file from…
Anton Egorov
  • 1,328
  • 1
  • 16
  • 33
0
votes
1 answer

jqxhr to local server can't find php file

I have updated this question as per Cimbali's suggestion. This is now the js code that specifies the request: ...... function editFiltName($thisFiltCell) { var cellText=$thisFiltCell.text(); var idx=$thisFiltCell.index(); //alert("idx:…
Banjobum
  • 57
  • 8
0
votes
0 answers

TypeError: Cannot read property 'length' of undefined using bodyParser

I am trying to make async file uploads using xhr: Here my frontend code: ... $el = $(selector) el = $el.get 0 // Worls data = new FormData() data.append "file", el.files[0] $.ajax url: "//#{window.config.host}/api/v1/versions/..." …
Vinz243
  • 9,654
  • 10
  • 42
  • 86
0
votes
1 answer

File upload progress not stoping on server error

I am currently working on a project which need an upload file input which I implemented based on some example I saw on this site and it works fine. function send(file){ var fd = new FormData(); fd.append(file.name, file); $.ajax({ …
0
votes
2 answers

Checking if web server is online/offline

How would I check if a web server is online/offline from my domain? I've already tried an $ajax call with jsonp, but if the server isn't responding with json, then that doesn't work. Is there any other way to get an http response from a server?
Nathan
  • 470
  • 2
  • 5
  • 15