javascript - Jquery, prevent redirecting, validating then submit the form -


i need validate form , display errors if there are. (that part of script working)

if there no error submit form (no ajax, keep redirecting before posted data).

my actual code not redirect @ all. don't see other way using .submit() posting data.

if i'm not mistaken window.location.href not post data.

 $('#contact-form').submit(function(e) {      e.preventdefault();      var count_error = 0;      // validating ...      if(count_error == 0){         $('#contact-form').submit(); //redirecting form action posted data     }  }); 

$("#contact-form").submit(function(e) {     var count_error = 0;      // validating ...      if (count_error == 0) {         return;     }     e.preventdefault(); }); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -