Stop redirect in JavaScript
<p>I have a function which verifies if some fields have been filled out (if length > 0) before submitting. If it fails to submit, I don't want to redirect the client at all. Right now, I have the following:</p>

<pre><code>function onSubmit()
{
  if (verify()) //This function will throw alert statements automatically
  {
     document.getElementById('my_form').submit();
     return void(0);
  }

  else
  {
     document.getElementById('my_form').action = null;
  }

}
</code></pre>

<p>However, it doesn't matter if verify() returns true or not, I still redirect the client and wipe her inputted fields. How do I keep the client on the page if a required field is blank? (I don't want to lose her currently filled out form...)</p>

<p>Also, I can't use the slick JQuery libraries, since it's not supported on some older browsers. (I'm trying to capture the most general audience.)</p>
