title: jquery: how to handle a redirect
body: <p>I have the following scenario:
  - a simple html page with a form and some "fields"
  - when the form is submitted it is performed a GET to a specified URL that replies "302" and the url where the user has to be redirected too is in "Location" header
  - i checked with fiddler and evetything seems correct</p>
  
  <p>The simple html page includes this piece of code:</p>
  
  <pre><code>function doSubmit() {
      var _url = $("#url").val();
      $.ajax({
          url: _url,
          complete: function(xmlHttp) {
              // xmlHttp is a XMLHttpRquest object
              alert(xmlHttp.status);
   }
  </code></pre>
  
  <p>The problem is that when submitting the request, i receive as statuscode: 0 and i'm not able to retrieve any "Location" header.</p>
  
  <p>UPDATE</p>
  
  <p>I tried using the Fetch API but it seems it doesn't work:</p>
  
  <pre><code>var req = new Request(url, {
      method: 'get',
      redirect: 'manual',
      "Cache-Control": "no-cache"
  });
  fetch(req).then(function (res) {
      alert(res.status);
  }, function (e) {
      alert('error');
  });
  </code></pre>
  
  <p>It always ends into an error.</p>