$("#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; });
.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