Answer the question
In order to leave comments, you need to log in
Why is ajax form not working in fancybox window?
Hello, there is a form in the fensibox modal window (type: inline), letters are sent, but the message about the successful sending of the letter does not appear, also the letters are empty. If you move the form from the modal window to the page, then everything works well. What could be the reason?
Ajax:
$("form").submit(function () {
// Получение ID формы
var formID = $(this).attr('id');
// Добавление решётки к имени ID
var formNm = $('#' + formID);
$.ajax({
type: "POST",
url: '<?php bloginfo('template_directory')?>/mail.php',
data: formNm.serialize(),
success: function (data) {
// Вывод текста результата отправки
$(formNm).html(data);
},
error: function (jqXHR, text, error) {
// Вывод текста ошибки отправки
$(formNm).html(error);
}
});
return false;
});
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