Skip to main content

Bug Tracker

Side navigation

#2994 closed bug (fixed)

Opened June 05, 2008 04:53PM UTC

Closed January 16, 2011 02:00AM UTC

Last modified January 28, 2011 01:02AM UTC

$.ajax error on 404 in IE

Reported by: Jeff Owned by:
Priority: high Milestone: 1.5
Component: ajax Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:
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');
             }
         } 
      );
Attachments (0)
Change History (11)

Changed June 05, 2008 05:28PM UTC by Jeff comment:1

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

Changed June 05, 2008 06:03PM UTC by Jeff comment:2

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

.....

Changed June 05, 2008 06:49PM UTC by Jeff comment:3

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

Changed June 06, 2008 12:58AM UTC by flesler comment:4

component: coreajax

Changed February 15, 2009 07:11PM UTC by dmethvin comment:5

Is it possible that

cache: true
(the default) is part of the reason?

Changed November 14, 2010 02:48PM UTC by dmethvin comment:6

resolution: → worksforme
status: newclosed

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

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

Changed November 14, 2010 02:58PM UTC by dmethvin comment:7

milestone: 1.3
resolution: worksforme
status: closedreopened

Changed November 14, 2010 03:00PM UTC by dmethvin comment:8

keywords: $.ajax 404 event error problem
priority: majorhigh
status: reopenedopen
summary: Jquery $.ajax event error problem$.ajax error on 404 in IE
version: 1.2.61.4.4

Whoops, it does break on IE8.

Changed December 27, 2010 10:36PM UTC by rwaldron comment:9

keywords: → ajaxrewrite

Changed January 16, 2011 02:00AM UTC by jaubourg comment:10

resolution: → fixed
status: openclosed

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

Changed January 28, 2011 01:02AM UTC by jitter comment:11

keywords: ajaxrewrite
milestone: → 1.5