Bug Tracker

Opened 9 years ago

Closed 9 years ago

#8000 closed enhancement (wontfix)

textStatus unavailable from ajaxError

Reported by: john.firebaugh Owned by: john.firebaugh
Priority: low Milestone: 1.next
Component: ajax Version: 1.5
Keywords: needsreview Cc:
Blocked by: Blocking:

Description

The jQuery.ajax error callback is passed XMLHttpRequest, textStatus, and errorThrown parameters.

The ajaxError callback is passed event, XMLHttpRequest, ajaxOptions, and thrownError parameters. The "textStatus" parameter should also be made passed, so that global ajaxError callbacks have access to the same state as error callbacks.

Reported on forums here: http://forum.jquery.com/topic/textstatus-unavailable-from-ajaxerror

Change History (7)

comment:1 Changed 9 years ago by Rick Waldron

Owner: set to john.firebaugh
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket!

Additionally, test against the jQuery 0 GIT version to ensure the issue still exists. Be Excellent to eachother!

comment:2 Changed 9 years ago by Rick Waldron

Component: unfiledajax

comment:3 Changed 9 years ago by danheberden

Congratulations! You've placed the 8000th bug ticket!

comment:4 Changed 9 years ago by tianon

The following diff implements the (backwards compatible!) fix found in one of the posts on the forum (created from latest "jQuery 0 GIT" code):

  • speed/jquery-basis.js

    diff --git speed/jquery-basis.js speed/jquery-basis.js
    index fff6776..8316277 100644
    jQuery.extend({ 
    53065306
    53075307                // Fire the global callback
    53085308                if ( s.global ) {
    5309                         (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e] );
     5309                        (s.context ? jQuery(s.context) : jQuery.event).trigger( "ajaxError", [xhr, s, e, status] );
    53105310                }
    53115311        },
    53125312

(I would attach a .patch, but Trac says no. :P)

comment:5 Changed 9 years ago by jitter

Keywords: needsreview added
Priority: undecidedlow
Status: pendingopen
Type: bugenhancement
Version: 1.4.41.5rc1

This could be a valid enhancement but needs some discussion.

The main problem I have with this is, that it would create yet another different signature (speaking of parameter order). Where the situation in that regard is already bad enough with the different ajax callbacks. But maybe it can't be made worse by adding another parameter. Marking for discussion for a future release

comment:6 Changed 9 years ago by jitter

Version: 1.5rc11.5

comment:7 Changed 9 years ago by john

Resolution: wontfix
Status: openclosed

As mentioned in another, similar, ticket - as soon as we can land this API change (1.7) we'll probably be removing, or significantly changing, global Ajax events.

Note: See TracTickets for help on using tickets.