Bug Tracker

Modify

Ticket #3591 (closed enhancement: duplicate)

Opened 5 years ago

Last modified 4 years ago

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
Blocking: Blocked by:

Description

xhr object is useful to get the headers values.

Attachments

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

Change History

Changed 5 years ago by alan.castro

adds xhr object to $.ajax success callback params.

comment:1 Changed 5 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 4 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 4 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 4 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 4 years ago by john

  • Status changed from new to closed
  • Version changed from 1.2.6 to 1.3.2
  • Resolution set to duplicate
  • Milestone changed from 1.3 to 1.4

Duplicate of #3363, which has been fixed.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.