When I execute a simple HTTP XML request from my server using the code below
var targetUrl = "http://server/Service1.svc?input1=uno&input2=duo"; document.getElementById("console").innerHTML += "<br>commencing"; var xhr = new XMLHttpRequest(); xhr.onload = function () { document.getElementById("console").innerHTML += "<br>callbacking"; alert(xhr.responseText); } xhr.open("GET", targetUrl); document.getElementById("console").innerHTML += "<br>finishing"; xhr.send();
I get the status code 302 in the FireBug console. According to this article W3 , a status code of 302 means that the resource is temporarily redirected. I'm not quite sure what this means in my case, because when I type my URL in FireFox, I get the answer as it should, looking great.
There are many articles in this article, but I cannot figure it out. For example, this only updates the status code definition. This option suggests using HEAD instead of GET, but this is not an option in my case (if absolutely necessary). Here, he even claimed that the status code 302 automatically leads to the correct redirect to plac where the page moved (as a result, the status code is 200), which is wrong in my case.
I tried looking at xhr.getRespoonseHeader("Content-Type") , but it seems to be null .
I am stuck. What can I do with my problem?
user1672517
source share