I'm having a redirect sent by my server but jquery's ajax error: callback seems to get xhr.status=200
and status="parseerror"
Anywork around?? I don't want to overload other codes since I use the for the things that they were intended for? Is this just not possible with jquery?
The callback is like this: error: function(xhr, status){...}
When you redirect from the server you can send a response header along with it. And then look for that respone header in the ajax error/success callback. I hope that will help you
var status = xhr.getResponseHeader("redirectResponseHeader");//Specify the same name in the server side code
Now using status
you can decide what to do.
The redirect codes 301, 302, 303, and 307 are handled by the user agent, so you can't access the redirect code from the callback.
Reference: XMLHttpRequest Level 2 spec
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.