Bug Tracker

Modify

Ticket #8000 (closed enhancement: wontfix)

Opened 2 years ago

Last modified 2 years ago

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

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

comment:1 Changed 2 years ago by rwaldron

  • Owner set to john.firebaugh
  • Status changed from new to pending

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 2 years ago by rwaldron

  • Component changed from unfiled to ajax

comment:3 Changed 2 years ago by danheberden

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

comment:4 Changed 2 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 2 years ago by jitter

  • Keywords needsreview added
  • Priority changed from undecided to low
  • Version changed from 1.4.4 to 1.5rc1
  • Status changed from pending to open
  • Type changed from bug to enhancement

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 2 years ago by jitter

  • Version changed from 1.5rc1 to 1.5

comment:7 Changed 2 years ago by john

  • Status changed from open to closed
  • Resolution set to wontfix

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.

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.