title: How to prevent AJAX post to send data if there is any validation error in form?
body: <p>I am trying to submit data using Jquery AJAX (using the following script) and it is working alright but the problem is it submits data even though there are some validation errors in my forms. I am using jQuery validation plug-in 1.7 to validate my forms. </p>
  
  <p>So my question is there any way to prevent the AJAX post to send data if there is any validation error in my form?</p>
  
  <p>Thanks :)</p>
  
  <pre><code> &lt;script  type="text/javascript"&gt;
    $(document).ready(function(){ // added
   $('#submit_item').click(function(){
  
     var teacherid = $('#teacherid').val();  
    var salary_amount = $('#salary_amount').val(); 
  
  
  
   $.ajax({
  
    type: "POST",
    url: "&lt;?php echo base_url(); ?&gt;addteacher_salary/add_ajax",
    data: "teacherid="+teacherid+ "&amp;salary_amount="+ salary_amount,
    success: function(html){
    $("#show").html(html);
  
  
     }
   });
  
   return false
   });
   }); // added
   &lt;/script&gt;
  </code></pre>