A
A
anon131992016-06-09 17:51:08
JavaScript
anon13199, 2016-06-09 17:51:08

I send a request, the response is 404 through the console, but from the server 200?

I send the request to the server via GET ajax.

In response, I get a 302 or 200 redirect (if you look in the browser through the network).

And through the console 404. How can this be?

You need to catch the error. 200 or 302, they then "come", but actually "404".

The request is correct, if through the url, then everything works, I get exactly the same answer through online verification services. Everything works 100% + to this, applications are created, but in the console it always writes 404.

What's the matter?

Code:

type: "GET",
url : "URL HERE",
data: data,
success: function(response) {
console.log(response.status);
document.getElementById('result_form1').innerHTML = "Success";
error: function(response) {
console.log(response.status);
document.getElementById('result_form1').innerHTML = "Error.";
},
statusCode: {
302: function() {
console.log('redirect');
}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2016-06-09
@ThunderCat

If the server is not yours, the request type or user agent is most likely being checked.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question