Bug Tracker

Modify

Ticket #2994 (closed bug: fixed)

Opened 5 years ago

Last modified 2 years ago

$.ajax error on 404 in IE

Reported by: Jeff Owned by:
Priority: high Milestone: 1.5
Component: ajax Version: 1.4.4
Keywords: Cc:
Blocking: Blocked by:

Description

Hi all, I have a problem on ajax error event handler with non existing file on url parameter -> 404 feedback ( the other event success / complete works fine all browser ). With the code below, FF 2.0.0.14 and OPERA 9.27 fire error event but IE 7 and SAFARI 3.1.1 not.

Thanks in advance, i start to look in your code ...

$.ajax (
	 {
	 type: 'POST',
	 url: 'a file that do not exist',
  	 dataType: 'HTML',
         data :'test=1',
	 success: function (data, textStatus) {	
             alert('success');
             },
         error: function (XMLHttpRequest, textStatus, errorThrown) {	 
	     alert('error');
             },
         complete : function(XMLHttpRequest, textStatus) {
	     alert('complete');
             }
         } 
      );

Change History

comment:1 in reply to: ↑ description Changed 5 years ago by Jeff

Adding "
xhr.status == 404" fix the problem, don't forget to add it in future release ;-)

comment:2 Changed 5 years ago by Jeff

Oups sorry guys that still don't work ( forget to update some cache ), if i check the header on requested file that don't exist by using  http://web-sniffer.net i have a nice and normal 302. If i display the xhr.status but adding alert('xhr status = '+xhr.status); inside Jquery a have this result :

FF xhr.status = 302 OPERA xhr.status = 0 IE xhr.status = 200 SAFARI = no display at all

.....

comment:3 Changed 5 years ago by Jeff

Method GET correct IE pb - Still don't work on Safari

comment:4 Changed 5 years ago by flesler

  • Component changed from core to ajax

comment:5 Changed 4 years ago by dmethvin

Is it possible that cache: true (the default) is part of the reason?

comment:6 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to worksforme

 http://jsfiddle.net/dmethvin/HG2v2/

Works in IE8, Safari 5, Chrome 7, Firefox 3.5.

comment:7 Changed 3 years ago by dmethvin

  • Status changed from closed to reopened
  • Resolution worksforme deleted
  • Milestone 1.3 deleted

comment:8 Changed 3 years ago by dmethvin

  • Keywords $.ajax 404 event error problem removed
  • Priority changed from major to high
  • Version changed from 1.2.6 to 1.4.4
  • Status changed from reopened to open
  • Summary changed from Jquery $.ajax event error problem to $.ajax error on 404 in IE

Whoops, it does break on IE8.

comment:9 Changed 2 years ago by rwaldron

  • Keywords ajaxrewrite added

comment:10 Changed 2 years ago by jaubourg

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

Fixes #2994. Not finding a transport now fires the error callbacks and doesn't make ajax return false. Had to revise how jsonp and script prefilters & transports work (better separation of concerns). Also took the opportunity to revise jXHR getRequestHeader and abort methods and enabled early transport garbage collection when the request completes.

Changeset: 8ab23aec2c333834a6e442fa15b73125ba857afe

comment:11 Changed 2 years ago by jitter

  • Keywords ajaxrewrite removed
  • Milestone set to 1.5

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.