Answer the question
In order to leave comments, you need to log in
Why doesn't the message about successful data sending work?
The data is successfully sent to the mail and the form is cleared. But the message about sending data is not displayed.
Please tell me where is the mistake.
html code on the page:
<form id="form1" action="#" class="feedback-form">
<input class="input" type="text" name="name" placeholder="Ваше имя" required>
<input class="input" type="tel" name="tel" placeholder="Ваш телефон" required>
<button type="submit" class="btn1">Отправить</button>
<span>Нажимая кнопку «Отправить» вы соглашаетесь на обработку персональных данных.</span>
</form>
<div class="hidden">
<div class="pop" id="pop">
Спасибо за обращение! <br> Заявка отправлена.
</div>
</div>
// Маска для формы телефона
$("input[type='tel']").inputmask({"mask": "+7 (999) 999-9999"});
// <input type="tel" placeholder="+7 (___) ___-___" name="tel">
//Аякс отправка форм
//Документация: http://api.jquery.com/jquery.ajax/
$(document).ready(function () {
$("#form1").submit(function () {
$.ajax({
type: "POST"
, url: "mail.php"
, data: $(this).serialize()
}).done(function () {
$(this).find("input").val("");
$("#form1").trigger("reset");
$.fancybox.open($("#pop"));
setTimeout(function () {
$.fancybox.close();
}, 1500);
});
return false;
});
});
.pop {
background-color: #fff;
max-width: 300px;
width: 95%;
text-align: center;
padding: 40px 15px;
border-radius: 5px;
font-size: 24px;
}
.pop .fancybox-close-small {
display: none;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question