Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to handle status 302?
    primarykey
    data
    text
    <p>When I execute a simple <em>XML HTTP Request</em> from my server using the code below</p> <pre><code>var targetUrl = "http://server/Service1.svc?input1=uno&amp;input2=duo"; document.getElementById("console").innerHTML += "&lt;br&gt;commencing"; var xhr = new XMLHttpRequest(); xhr.onload = function () { document.getElementById("console").innerHTML += "&lt;br&gt;callbacking"; alert(xhr.responseText); } xhr.open("GET", targetUrl); document.getElementById("console").innerHTML += "&lt;br&gt;finishing"; xhr.send(); </code></pre> <p>I get status code 302 in the console of FireBug. According to <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" rel="nofollow noreferrer">this W3 article</a>, 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.</p> <p>There are numerous articles regarding this issue but I can't get it straight. For instance, <a href="https://stackoverflow.com/questions/12420686/how-to-correctly-deal-with-302-status-code">this one</a> only restates the definition of the status code. <a href="https://stackoverflow.com/questions/6299021/ajax-and-status-302">This one</a> suggests to use <em>HEAD</em> instead of <em>GET</em> but that's not an option in my case (unless absolutely necessary). <a href="https://stackoverflow.com/questions/7524039/problems-with-xmlhttprequest-status-302">Here</a> it's even claimed that the status code 302 <strong>automatically</strong> 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.</p> <p>I've tried looking at <code>xhr.getRespoonseHeader("Content-Type")</code> but, apparently, it's <code>null</code>.</p> <p>I'm stuck. What can I do about my problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload