title: How to post form without waiting for response
body: <p>How do you post a form(in javascript) and make the browser not wait for response? Is this possible at all? The pattern I want to create is a sort of "Fire and Forget" pattern. Here is the code that performs the submittion:</p>
  
  <pre><code>var iframe = document.createElement("iframe");
  var unikString = "UNIQUE STRING";
  document.body.appendChild(iframe);
  iframe.style.display = "none";
  iframe.contentWindow.name = unikString;
  
  var form = document.createElement("form");
  form.target = unikString;
  form.action = "[THEURL]";
  form.method = "POST";
  
  document.body.appendChild((function(){
      document.createElement("input");
      input.type = "hidden";
      input.name = "NAME";
      input.value = "VALUE";
      return input;
  })());
  
  setTimeout(function ()
  {
      form.submit();
  }, 0);
  </code></pre>
  
  <p>(The form posting is done this way because i have to post to an end point outside the domain, and therefore the CORS problem must be overcome.)</p>