title: Required fields are not working with ajax
body: <p>I have created a Registration Form and set its <code>input</code> field to <code>require</code> attribute but its not working with ajax</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div class="form-group"&gt;
      &lt;input required  type="text" id="First_name" placeholder="Enter your First Name" value="" class="form-control login-field"&gt;
      &lt;i class="fa fa-user login-field-icon"&gt;&lt;/i&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
      &lt;input required  type="text" id="last_name" placeholder="Enter your Last Name" value="" class="form-control login-field"&gt;
      &lt;i class="fa fa-user login-field-icon"&gt;&lt;/i&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
      &lt;input required  type="text" id="reg_username" placeholder="Enter your User Name    " value="" class="form-control login-field"&gt;
      &lt;i class="fa fa-user login-field-icon"&gt;&lt;/i&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
      &lt;input required  type="email" id="email" placeholder="Enter your Email" value="" class="form-control login-field"&gt;
      &lt;i class="fa fa-user login-field-icon"&gt;&lt;/i&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
      &lt;input required  type="password" id="password" placeholder="Password" value="" class="form-control login-field"&gt;
      &lt;i class="fa fa-lock login-field-icon"&gt;&lt;/i&gt;
  &lt;/div&gt;
  &lt;a id="register" class="btn btn-success modal-login-btn"&gt;Sign up&lt;/button&gt;
  </code></pre>
  
  
  
  <p>and here is ajax code </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function(){
    $("#register").click(function(e){         
     if($("form").valid()){
        e.preventDefault();
     }
    var firstname=$('#First_name').val();
    var lastname=$('#last_name').val();
    var username=$('#reg_username').val();
    var password=$('#password').val();
    var email=$('#email').val();
    $.ajax({
      type: "POST",
      url: "doRegister.php",
      data: 
           "first_name=" +firstname+ "&amp;last_name=" +lastname+ "&amp;username="+ username+ "&amp;password="+ password+ "&amp;email="+ email ,
      success: function(html){
        document.write(html);
      }
    });
    return false;
  });
  });
  &lt;/script&gt;
  </code></pre>
  
  
  
  <p>i just want to run required field validation with ajax i could not find any solution .</p>