When I execute a simple XML HTTP 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 status code 302 in the console of FireBug. According to this W3 article, status code 302 means that the resource is temporarily redirected. I'm not fully certain on what that mean in my case because when I type my URL into the FireFox, I get the response as supposed to, looking great.
There are numerous articles regarding this issue but I can't get it straight. For instance, this one only restates the definition of the status code. This one suggests to use HEAD instead of GET but that's not an option in my case (unless absolutely necessary). Here it's even claimed that the status code 302 automatically leads to a correct redirect to the plac ewhere the page moved to (resulting in status code 200), which in my case isn't true.
I've tried looking at xhr.getRespoonseHeader("Content-Type")
but, apparently, it's null
.
I'm stuck. What can I do about my problem?