$("#contactForm").each(function() { $(this).validate({ rules: { name: {required: true}, email: {required: true}, phone: {required: true} }, messages: { name: "Введите ваше имя!", email: "Введите ваш email!", phone: "Введите ваш телефон!" } }); }); 
 $("#contactForm").submit(function() { var form = $(this); $.ajax({ type: "POST", url: 'http://piccolosolo.ru/form_download.php', data: form.serialize(), success: function(data) { $("#messageResult").html(data); }, error: function(data, textStatus, jqXHR) { $("#messageResult").html(JSON.stringify(data)); } }); return false; }); 
  • Do you have two forms with the same ID? - Regent
  • yes, but these are pop-ups with different html contents + your php handler. without validation forms work - Andre Bodre
  • .each() after $("#contactForm") meaningless, because 0 and 1 elements are selected by ID ( # ), but not two. .submit() , similarly, will only work for the first form. The correct approach in this case would be to replace the ID with the class. - Regent
  • A complete reproducible code sample should be in question, not on a third-party site. There are some reasons for this. But even if you leave only the submitted JS-code in the question, a complete example (without any pictures, menus and other things - only forms) should be placed, for example, on JSFiddle . - Regent
  • added by jsfiddle.net/a2media/77z112Lj - Andre Bodre

0