Side navigation
#13923 closed bug (wontfix)
Opened May 22, 2013 08:27PM UTC
Closed May 23, 2013 12:33AM UTC
Last modified January 30, 2014 11:28PM UTC
statusCode can not be initialized as an ajax option in $.ajaxPrefilter
Reported by: | thomasrosshallock | Owned by: | jaubourg |
---|---|---|---|
Priority: | blocker | Milestone: | None |
Component: | ajax | Version: | 2.0.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Here is a demonstration of this issue:
Attachments (0)
Change History (3)
Changed May 22, 2013 11:30PM UTC by comment:1
component: | unfiled → ajax |
---|---|
owner: | → jaubourg |
priority: | undecided → blocker |
status: | new → assigned |
Changed May 23, 2013 12:33AM UTC by comment:2
resolution: | → wontfix |
---|---|
status: | assigned → closed |
OK, I've looked into this and it's quite tricky to fix because we have some nasty interaction with jqXHR.statusCode()
so what I'd recommend is to actually use jqXHR.statusCode()
instead of manipulating the option directly:
$.ajaxPrefilter( function( _, jqXHR ) { jqXHR.statusCode( { 404: function() { // Your code here } } ); } );
Changed January 30, 2014 11:28PM UTC by comment:3
} else if ( type === "error" ) { complete( // file protocol always yields status 0, assume 404 xhr.status || 404, xhr.statusText );
And this is what you get
Confirmed in both 1.x and 2.x.