title: JavaScript XMLHttpRequest() and Redirect
body: <p>I want to send a XMLRequest to server and then redirect user to front page so far 
  I have:</p>
  
  <pre><code>var posts = new XMLHttpRequest();
  var api="XXXXXXXXXX";
  posts.open("GET", api+user+"/"+password+"/"+id+"/"+latitude, true);
  posts.send();
  
  window.location = "index.html"
  </code></pre>
  
  <p>If I only run the code without the redirect at the end it works great but if I have a the redirect the API GET request fails. Can someone explain to me what I'm missing?</p>