Hello. How do I fix the script so that the form is sent correctly? I just can not understand what is wrong.
$(".form").validate({ rules: { name: { required: true, minlength: 2, maxlength: 32 }, phone: { required: true, minlength: 10 } }, messages: { name: { required: 'Заполните имя' }, phone: { required: 'Заполните телефон' } }, submitHandler: function(form) { $(".form").submit(function() { //Change var th = $(this); $.ajax({ type: "POST", url: "mail.php", //Change data: th.serialize() }).done(function() { $('.form-phone').addClass('form-active-phone'); th.trigger("reset"); setTimeout(function(){ $('.form-phone').removeClass('form-active-phone'); }, 3000); return false; }); return false; }); } });