title: Form validation with click event
body: <p>I have a form with validation:</p>
  
  <pre><code>       &lt;form role="form" method="POST" action="" &gt;
              &lt;input type="password" class="form-control top-buffer-sm" placeholder="Password" name="password" required autofocus&gt;&lt;/input&gt;
              &lt;input type="email" class="form-control top-buffer-sm" placeholder="Email" name="email" required autofocus&gt;&lt;/input&gt;
  &lt;div class="modal-footer"&gt;
      &lt;button id="createUser" type="submit" class="btn btn-primary"&gt;Create&lt;/button&gt;
      &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>My submit button has an id and i need to do some other functionality before i submit the form:</p>
  
  <pre><code>      $('#createUser').click(function(){
              //check to see if validation passed
               //do custom stuff
               //now make ajax call
  
               $.ajax();
          });
  </code></pre>
  
  <p>but if the form is not valid, my ajax call is still being made, of course resulting in a server error. How do i check to see if the form passed the validation when i click the submit button? Thanks</p>