Bug Tracker

Opened 14 years ago

Closed 13 years ago

#3591 closed enhancement (duplicate)

Patch: xhr object isn't returned in $.ajax() success callback

Reported by: alan.castro Owned by:
Priority: major Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: Cc: alan.castro
Blocked by: Blocking:


xhr object is useful to get the headers values.

Attachments (1)

jquery-ajax-xhr.patch (401 bytes) - added by alan.castro 14 years ago.
adds xhr object to $.ajax success callback params.

Download all attachments as: .zip

Change History (6)

Changed 14 years ago by alan.castro

Attachment: jquery-ajax-xhr.patch added

adds xhr object to $.ajax success callback params.

comment:1 Changed 14 years ago by flesler

Cc: alan.castro added

I think you are meant to use the complete callback for that. It does receive the xhr, they have different purposes.

comment:2 Changed 14 years ago by robmonie

I would also really like to see this change. What i'm after is the ability to check my xhr for specific headers before proceeding with inserting the data returned into the dom. The success callback is really the only place for this that I can tell.

Using the complete() callback is no good for that as it doesn't take the data as a parameter. It's likely I can extract this from the xhr object itself however this seems potentially fragile. It would be much nicer to just have it passed into the success callback directly.

comment:3 Changed 14 years ago by nbubna

I'd also appreciate this. Like you say, Ariel, the complete and success callbacks have different purposes, and it's in the success callback that i'd like access to the xhr. :)

comment:4 Changed 13 years ago by robustsolution

I also ask why? the error callback contains the XHR object in its signature while the success callback doesn't have it!.

comment:5 Changed 13 years ago by john

Milestone: 1.31.4
Resolution: duplicate
Status: newclosed

Duplicate of #3363, which has been fixed.

Note: See TracTickets for help on using tickets.