Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8003865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:45:52+00:00 2026-06-04T16:45:52+00:00

In the jQuery docs regarding Deferreds , there’s this example of returning ajax args

  • 0

In the jQuery docs regarding Deferreds, there’s this example of returning ajax args including jqXHR:

$.when( $.ajax("test.php") ).then(function(ajaxArgs){ 
    alert(ajaxArgs[1]); /* ajaxArgs is [ "success", statusText, jqXHR ] */
});

But it seems that the docs are wrong. ajaxArgs is actually the response from the $.ajax call.

I need to get access to the jqXHR object because I need some meta data about the actual call, but it seems to be pretty hackish. This is what I’m currently doing, but there’s got to be a better way (crossing my fingers).

xhr = $.ajax({
    'url': src,
}).done(function () {
    var meta = xhr.getResponseHeader(...);
});

What’s the best/easiest way to get access to the jqXHR data that I need?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:45:53+00:00Added an answer on June 4, 2026 at 4:45 pm

    Use the third argument:

    .then(function(text,status,xhr) {
       var meta = xhr.getResponseHeader(...);
    });
    

    Note however that if you pass multiple deferreds into $.when, it’l be the 3rd index of the first argument, second, or third depending on which request you want the headers of.

    $.when( $.ajax("test.php"),$.ajax("test.php"),$.ajax("test.php") ).then(function(){ 
        var meta1 = arguments[0][2].getResponseHeader(...);
        var meta2 = arguments[1][2].getResponseHeader(...);
        var meta3 = arguments[2][2].getResponseHeader(...);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's an example taken from http://docs.jquery.com/API/1.1/AJAX#.24.post.28_url.2C_params.2C_callback_.29 $.ajax({ type: POST, url: some.php, data: name=John&location=Boston, success:
jQuery autocomplete docs state there should be two Models, the first being the model
I'm trying to use the autocomplete plugin for jQuery (this one http://docs.jquery.com/Plugins/Autocomplete ). My
Is there a jQuery shortcut for this? $(element).on(mouseover, function() { $(this).addClass(hover); }).on(mouseout, function() {
I have this as a test harness: <html> <script src=jquery-1.7.1.min.js></script> <script src=jquery-ui-1.8.18.custom.min.js></script> <script type=text/javascript>
I have got to this so far using the jQuery docs $('[class^=layout] > (*)').click(function(e)
In the jQuery docs mostly every string is declared using single quotes. Including the
I was reading the http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery . And got confused with use of this in
Are the docs for jQuery's on() function incorrect (or unclear)? Consider this code: <div>
I've looked around through the jQuery docs and google and I can't seem to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.