Site pulled on WordPress.
The usual forms on the site work, but in the modal window does not.
The console shows nothing. The send button does not respond.
Broke my head. Help find the problem.
Code JS:
$(document).on("submit", "form", function () {
var formID = $(this).attr('id');
var formNm = $('#' + formID);
$.ajax({
type: "POST",
url: 'mail.php',
data: formNm.serialize(),
success: function (data) {
$(formNm).html(data);
},
error: function (jqXHR, text, error) {
$(formNm).html(error);
}
});
return false;
});
Html form on pop-up (id different):
<form action="mail.php" method="POST" id="formModal1">
<input type="text" name="t-number" placeholder="Ваш телефон" required />
<input type="submit" placeholder="Получить консультацию" />
</form>
Php :
<?php
if (isset($_POST['t-number'])) {$phone = $_POST['t-number'];}
if (isset($_POST['email'])) {$email = $_POST['email'];}
$address = "";
$mes = "Тема: Заказ обратного звонка!
Телефон: $phone
E-mail: $email";
$sub='Заказ';
$mail='Заказ <Центр юридической помощи>';
$send = mail ($address,$sub,$mes,"Content-type:text/plain; charset = utf-8
From:$mail");
ini_set('short_open_tag', 'On');
?>