title: How to submit form with Ajax and Jquery Validation?
body: <p>I am trying to submit a from with Ajax and use query validation plugin to validate it . I write code below :</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
       &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"&gt;&lt;/script&gt;
       &lt;script src="jquery.validate.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;form id="myForm"&gt;
          &lt;input type="text" name="name" /&gt;
          &lt;br/&gt;
          &lt;input type="text" name="school" /&gt;
          &lt;br/&gt;
          &lt;input type="submit" /&gt;
      &lt;/form&gt;
      &lt;div id="result"&gt;&lt;/div&gt;
  
  &lt;script&gt;        
      $(document).ready(function () {
  
      $("#myForm").validate({ 
          onkeyup: false,
          rules: {
              name: {
                  required: true,
                  minlength: 5
              },
              school: {
                  required: true,
                  minlength: 5
              }
          }
      });
  
      event.preventDefault();
      $("#result").html('');
      var values = $(this).serialize();
  
      $("#myForm").ajaxForm({
          url: "add_admin.php",
          type: "post",
          data: values,
          beforeSubmit: function () {
              return $("#myForm").valid();
          },
          success: function(){
              //alert("success");
              $("#result").html('Submitted successfully');
          },
          error:function(){
  //            alert("failure");
              $("#result").html('There is error while submit');
          }
      });
  
  });
  
  &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>but it didn't work . Made I any mistake here ?
  can any one help me ?
  some text some text some text some text some text </p>