Help to validate correctly: form with ajax

Help to validate correctly: form with ajax

Hello friends. This form works to email. I need help: when validate display the div "this form has been sent correctly"



  1. $("#form1").submit(function(){
  2.      if(validateUsername() & validatePassword1() & validatePassword2() & validateEmail())      
  3. return true;
  4. else
  5. return false;
  6. });


  1. $(document).ready(function() {

  2.   $(document).ajaxStart(function() {
  3.         $('#loading').show();
  4.         $('#result').hide();
  5.     }).ajaxStop(function() {
  6.         $('#loading').hide();
  7.         $('#result').fadeIn('slow');
  8.     });
  9.     $('#form1').submit(function() {
  10.         $.ajax({
  11.             type: 'POST',
  12.             url: $(this).attr('action'),
  13.             data: $(this).serialize(),
  14.             success: function(data) {
  15.                 $('#result').html(data);

  16.             }
  17.         })
  18.         
  19.         return false;
  20.     }); 
  21.   
  22. })  


MIKEPIANIST