I need to redirect user if request returns 302 or 303. It seems that there isn’t a standard way to do this (odd, I thought it’s quite a common task).
I have this code:
var request = new Request({
url: "/some-url/",
method: 'get',
evalScripts: true,
onComplete: function(){
console.log(this.status);
}
});
Console prints 0 status but web inspector shows that the status code is 302 Found, so I can’t manually check the code and get redirected. Anyone know what I’m doing wrong?
Thanks.
normally, an ajax request to a 301/302/303 etc will follow the new
locationand re-issue the request as per specification. if you are not seeing a second request, something is wrong, like an infinite loop or similar…more here: http://dev.w3.org/2006/webapi/XMLHttpRequest/#infrastructure-for-the-send-method