title: If jquery's form validation is ok, then I want to run a function before submitting the form
body: <p>I'm using this to validate my form and it is fine:</p>
  
  <pre><code>
      $(document).ready(function() {
          $("#myform").validate();
      });
  </code></pre>
  
  <p>But I need to run a function before the form submits but only if validation has passed.  When I try to add the function after the validate, like this:</p>
  
  <pre><code>
      $(document).ready(function() {
           $("#myform").validate();
           $('#submitButton').click(function() {
              ...
           });
      });
  </code></pre>
  
  <p>it runs even when the form fails validation.</p>
  
  <p>I've also tried putting the validate function within the submitButton click and the same thing happens -- the function runs even if the form fails validation:</p>
  
  <pre><code>
      $(document).ready(function() {
           $('#submitButton').click(function() {
              $("#myform").validate();
              ...
              ...
           });
      });
  </code></pre>