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 comment:1
Changed June 05, 2008 06:03PM UTC by 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 comment:3
Method GET correct IE pb - Still don't work on Safari
Changed June 06, 2008 12:58AM UTC by comment:4
| component: | core → ajax |
|---|
Changed February 15, 2009 07:11PM UTC by comment:5
Is it possible that
cache: true(the default) is part of the reason?
Changed November 14, 2010 02:48PM UTC by comment:6
| resolution: | → worksforme |
|---|---|
| status: | new → closed |
http://jsfiddle.net/dmethvin/HG2v2/
Works in IE8, Safari 5, Chrome 7, Firefox 3.5.
Changed November 14, 2010 02:58PM UTC by comment:7
| milestone: | 1.3 |
|---|---|
| resolution: | worksforme |
| status: | closed → reopened |
Changed November 14, 2010 03:00PM UTC by comment:8
| keywords: | $.ajax 404 event error problem |
|---|---|
| priority: | major → high |
| status: | reopened → open |
| summary: | Jquery $.ajax event error problem → $.ajax error on 404 in IE |
| version: | 1.2.6 → 1.4.4 |
Whoops, it does break on IE8.
Changed December 27, 2010 10:36PM UTC by comment:9
| keywords: | → ajaxrewrite |
|---|
Changed January 16, 2011 02:00AM UTC by comment:10
| resolution: | → fixed |
|---|---|
| status: | open → closed |
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 comment:11
| keywords: | ajaxrewrite |
|---|---|
| milestone: | → 1.5 |
Adding "|| xhr.status == 404" fix the problem, don't forget to add it in future release ;-)