title: Ajax form validate when submit
body: <p>How do I write code within ajax block in order to validate form fields?</p>
  
  <p>I need to check fields firstname, lastname and email before ajax request page described below. Basically if fields are empty do nothing. The chunk of code is below.</p>
  
  <p>HTML is plain. Its submit is 
      <code>input class="red" id="send" type="submit" name="send" value="Send Message"</code></p>
  
  <pre><code>jQuery( document ).ready(function(){
  jQuery( '#ajax_form' ).submit(function(){
    var data = jQuery( this ).serialize();
  
    jQuery.support.cors = true;
  
   // var email = $data("email").val();
  
    jQuery.ajax({
      type: "POST",
      url: "http://ecommerce.natopia.com/notifications/check-availability",
      data: data,
      success: function( data ){}
    });
  
  
  //  closeCheckAvailability();
    return false;
  });
  });
  
  
  function closeCheckAvailability(){
        $("div.on1").fadeOut("slow");
        $(".overOuter5").fadeOut("slow");
        $('.overOuter5').removeClass('displayBlock');
        $("#aa5").removeClass('displayBlock');
        $("#aa5").hide();
  }
  </code></pre>