title: Submit a form in the background
body: <p>How can I submit a form to a third-party website without it causing the page to reload (i.e. in the background)?</p>
  
  <p>For some background, I'm trying to programmatically log a user into their google account in the background.</p>
  
  <p>I can programmatically log them in using the following:</p>
  
  <pre><code>var div = document.createElement("div");
  div.innerHTML = FORM_HTML;
  var form = div.getElementsByTagName("form")[0];
  form.action = "https://www.google.com/accounts/ServiceLoginAuth";
  form.GALX.value = FORM_GALX; // dynamically obtained using AJAX
  form.Email.value = USER_EMAIL;
  form.Passwd.value = USER_PASSWORD;
  form.submit();
  </code></pre>
  
  <p>This logs me in and opens up my Google dashboard.  How can I prevent <code>form.action</code> from redirecting me?</p>
  
  <p>Please note that this div is never actually added to a document, which is preferable but not required.</p>