// Contact form
var form = $('#main-contact-form');
form.submit(function(event){
event.preventDefault();
var form_status = $('<div class="form_status"></div>');
$.ajax({
url: $(this).attr('action'),
method: "POST",
data: {
message : form.children('input[name="message"]').val(),
name: form.children('input[name="name"]').val(),
email: form.children('input[name="email"]').val()
},
beforeSend: function(){
form.prepend( form_status.html('<p><i class="fa fa-spinner fa-spin"></i> Email is sending...</p>').fadeIn() );
}
}).done(function(data){
form_status.html('<p class="text-success">Thank you for contact us. As early as possible we will contact you</p>').delay(3000).fadeOut();
});
});
// Contact form
var form = $('#main-contact-form');
form.submit(function(event){
event.preventDefault();
var form_status = $('<div class="form_status"></div>');
$.ajax({
url: $(this).attr('action'),
beforeSend: function(){
form.prepend( form_status.html('<p><i class="fa fa-spinner fa-spin"></i> Email is sending...</p>').fadeIn() );
}
}).done(function(data){
form_status.html('<p class="text-success">Thank you for contact us. As early as possible we will contact you</p>').delay(3000).fadeOut();
});
});
event.preventDefault();
"body" => json_encode(array('$filter' => '1 eq 1','text' => 'Test notification for all subscribers'))) );
// Отправка данных на сервер
$('#form').trigger('reset');
$(function() {
'use strict';
$('#form').on('submit', function(e) {
e.preventDefault();
// <-- здесь можно валидацию при необходимости сделать
alert('Наш менеджер в скором времени свяжется с вами!'); // ВОТ ЭТОТ ОТВЕТ
$.ajax({
url: 'send.php',
type: 'POST',
contentType: false,
processData: false,
data: new FormData(this),
success: function(msg) {
console.log(msg);
if (msg == 'ok') {
$('#form').trigger('reset'); // очистка формы
} else {
alert('Ошибка');
}
}
});
});
});
print_r($_REQUEST);