title: how to not submit the form to the database with already existing email using jquery validation plugin ajax
body: <p>Hello everybody i am using jquery validation plugin. It's just working fine but my problem is if there is email exists a database. The form should not submitted until another valid email he choose. how to solve this problem. </p>
  
  <p>The form is submitting even the email already exit in the database. </p>
  
  <p>Here is form with ajax</p>
  
  <pre><code>&lt;form id="ajax_form" action="form_action.php"&gt;
  &lt;label for="name"&gt;Name :&lt;/label&gt;
    &lt;input name="name" type="text"  required /&gt;
  
    &lt;label for="name"&gt;Email :&lt;/label&gt;
    &lt;input name="email"  type="email" required /&gt;
    &lt;input type="submit" value="Submit" /&gt;
  &lt;/form&gt;
    &lt;p id="validemail"&gt;&lt;/p&gt;
  
  
  $(function(){
      $("#ajax_form" ).validate({
          rules: {
              email: {
                  required: true,
                  email: true,
                  remote: {
                      url: "check_email.php",
                      type: "post",
                      data: {
                          username: function() {
                              $("#validemail").html('This email already taken');
                          }
                      }
                  }
              }
          }
      });
  });
  </code></pre>
  
  <p>Here is my check_email.php for checking the email exits or not.</p>
  
  <pre><code>mysql_connect('localhost', 'root', '');
  mysql_select_db('krk');
  $query = mysql_query("SELECT ID FROM customers WHERE email = '{$email}' LIMIT 1");
  if (mysql_num_rows($query)) {
      return true;
  }
  else{
      return false;
  }
  </code></pre>
  
  <p>The form should not submitted until another valid email he choose. how to solve this problem. </p>
  
  <p>The form is submitting even the email already exit in the database.
   The form should not submitted until another valid email he choose. how to solve this problem. 
          The form is submitting even the email already exit in the database.
   The form should not submitted until another valid email he choose. how to solve this problem. 
          The form is submitting even the email already exit in the database.</p>