title: How to prevent redirect on submit() when error is received?
body: <p>I'm working with pages like <a href="http://musicbrainz.org/release/72cf3c87-d97d-49cc-8781-661ad3580091/cover-art-uploader?id=17477511090" rel="nofollow">http://musicbrainz.org/release/72cf3c87-d97d-49cc-8781-661ad3580091/cover-art-uploader?id=17477511090</a> .  This is generally an iframe's source, but I'm using it outside of the iframe, in a userscript.  I've been testing submitting the form on that page with javascript, but I do not want the redirect after submission.</p>
  
  <p>Here's the js I've been running from the console: </p>
  
  <pre><code>jQuery(document.forms[0]).submit(function (e) {
      e.preventDefault();
      alert('foo');
      return false;
  })[0].submit();
  </code></pre>
  
  <p>From everything I know, it ought to submit, then the event handler kick in to stop the redirect.  However, when the server gives anything other than a 200 status, such as 500 Internal Server Error, I still get the redirect.</p>
  
  <p>So 1) How can I detect the error, and its status code,
  and 2) how can I prevent the redirect, even when the result is an error?</p>