Returning false in first of multiple form submission handlers
<p>I have two submit handlers, one validating a form and one submitting the form:</p>

<pre><code>// validates the form but does not submit it
$("form").submit(function() {
  // perform validation here and set "validationFails" appropriately
  // ...
  if (validationFails) {
    return false;
  }
});

// submits the form via ajax
$("form").submit(function(event) {
  event.preventDefault();
  // submit the form via ajax here
  // ...
});
</code></pre>

<p>It seems like the form should not be submitted via ajax if validation fails because <code>return false</code> is used, and so the subsequent <code>submit</code> handler in the chain should not be called. However, even if validation fails, the form is submitted via ajax. Why?</p>
