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

Why does this Python Flask router return a 400 error when pinged by a crossdomain AJAX call?

I have the below Python Flask router: @app.route('/create', methods=['GET', 'POST']) @crossdomain(origin='*') def create(): if request.method == 'POST': print(request.form) title = request.form['title'] url =…
chromedude
  • 4,246
  • 16
  • 65
  • 96
2
votes
2 answers

What format is a jQuery ajax post request sending the data in and how can it be accessed through Flask's request object?

I am creating a web page that sends an XHR AJAX request using jQuery's $.post() object. The post is being received by a Flask app that is on another domain. The Javascript is below: $.post('http://myurl.com/create', { 'title': sender.title, …
chromedude
  • 4,246
  • 16
  • 65
  • 96
2
votes
0 answers

IE XHR: jQuery.ajax vs TJ's superagent

I noticed TJ Holowaychuk's superagent library ("Ajax with less suck") try's several ActiveXObject methods for IE when generating a cross browser XHR object: // ...if normal browser: return new XMLHttpRequest; } else { try { return new…
Devin Rhode
  • 23,026
  • 8
  • 58
  • 72
2
votes
1 answer

Basic authentication using XHR

I am trying to get some response from my server which needs basic authentication. So when I use curl as: curl -u user:pass http://myserver.com/get/send-my-data It is giving me correct response. But when I am creating an XHR request using jquery…
Sachin Jain
  • 21,353
  • 33
  • 103
  • 168
2
votes
1 answer

How to catch 405 Method Not Found in jQuery.ajax()

I'm trying to catch if the website is accidentally making a cross domain call (for example if the user types the IP in the url instead of the domain. (This is a commercial, installable app so I don't have IIS control to set up any forwarding,…
Warren J Thompson
  • 408
  • 1
  • 7
  • 19
1
vote
1 answer

How to Access XHR Object When Making AJAX Requests with Backbone's Fetch()?

Within a backbone app, I am making a call with fetch when a users takes a certain action: changeDay: function() { this.collection.fetch({ success: function() { lr.primaryView.addAllEvents(); } }); }, ... Sometimes, a user takes…
1
vote
2 answers

Problems Reading the HTTP Status/Error Code from jQuery AJAX

I'm trying to appropriately handle a HTTP status error (404, 501, etc) that might be returned by any AJAX call in jQuery (I'm using version 1.6.4) however for the life of me I can't get out the appropriate response code (all values are '0' or…
Oliver Pearmain
  • 19,885
  • 13
  • 86
  • 90
1
vote
1 answer

How to avoid console error 403 when backend not give return

If I set my channel like this, I get console error 403. note:: if ($user->status) isn't reg. Broadcast::channel('using', function ($user) { if($user->status=='reg'){ return $user->id; } }); If I set my channel like this, everything…
1
vote
3 answers

Return result of .then() lambda expression as function result

I'm relatively new to js so please forgive me if my wording isn't quite right. I've also created a jsfiddle to demonstrate the issue. Overview In the app I'm working on, I have a function with a jquery ajax call, like this: function…
Daniel
  • 1,695
  • 15
  • 33
1
vote
1 answer

How to access proprietary XHR methods using JQuery 1.5 AJAX functions (jqxhr object)

I am developing for a proprietary browser (samsung tv) that provides a special method xhr.destroy() wich has to be called after every AJAX completed. My question is, is there any way to access this method (or any browser proprietary method ) using…
Gibarian2001
  • 907
  • 1
  • 7
  • 5
1
vote
1 answer

Can I update DOM while XHR data is loading?

I am using Slick JS to create a slider, adding slides to it using AJAX and the slickAdd method as follows: $.getJSON(url, function(r) { $.each(r, function(i, article) { var html = 'HTML string created with data and ' + article.variables + '…
Rhecil Codes
  • 511
  • 4
  • 24
1
vote
1 answer

After session expires my ajax call returns file not found error?

I have created login system for single page app. First step inn login process is user authentication. Once user logged in their session will start. I have set 30 minutes session time on the server side. On the client side I have JavaScript that…
espresso_coffee
  • 5,980
  • 11
  • 83
  • 193
1
vote
0 answers

Error 500 service worker response error

I have an upload function with AJAX Progress Listener. However, some requests failed due to jqXHR.status == 500 and errorThrown is "Service Worker Response Error". Anyone knows how to reproduce and fix this issue?
sakura
  • 294
  • 2
  • 11
1
vote
1 answer

Why does jqXHR.done() return jqXHR object?

Received jqXHR object from my $.post query contains done function. But I realized that this function returns just its jqXHR object: $.post(query, function(a,b,jqXHR) { jqXHR === jqXHR.done() //true }); How shoud I interpret that?
Karol Selak
  • 4,248
  • 6
  • 35
  • 65
1
vote
2 answers

Jquery Ajax Upload with progress is reloading page

I have strange stuf with a Jquery form submit. After the upload completed, the page is reloading even in the server has not finished to process. The server just return a json succes status, so It's not on server side. Here"s the…
Julien
  • 411
  • 4
  • 13