I don’t see how anything like this will help:
$.ajax({
statusCode: {
404: function() {
alert( "page not found" );
}
/* neither will 301, 307 or 308 */
}
});
And neither statusCode
nor statusCode()
actually exist. As a variable or function:
Uncaught ReferenceError: statusCode is not defined
When I mentioned (and you quoted):
Folk mentioned statusCode but that only returns int(3) and returns 200 when redirected as well. It has nothing for me.
statusCode
callbacks do nothing for me because:
I’m trying to get location that it’s landed on (it’s being redirected there by server-side script), and I need to know the location it finally lands on.
With which statusCode won’t help me because
Folk mentioned statusCode but that only returns int(3) and returns 200 when redirected as well. It has nothing for me.
I can’t get resulting location from statusCode
. Because it doesn’t return 301
, 307
or 308
, when it’s redirected, it has no use for me. HTTP response code doesn’t help because it always returns 200. This snippet:
$.ajax({
url: "item.php",
type: "GET",
statusCode: {
200: function() {
console.log("It worked");
},
301: function() {
console.log("It didn't work");
}
}
});
Always returns “It worked” whether redirected or not.
Like I already mentioned:
Folk mentioned statusCode but that only returns int(3) and returns 200 when redirected as well. It has nothing for me.