Created
March 24, 2015 02:32
-
-
Save fnnzzz/f286c7b5055af2432cc5 to your computer and use it in GitHub Desktop.
sendmail ajax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$recepient = "agragregra@ya.ru"; | |
$sitename = "УЧЕБНЫЙ АДАПТИВНЫЙ САЙТ №1"; | |
$name = trim($_GET["name"]); | |
$phone = trim($_GET["phone"]); | |
$pagetitle = "Новая заявка с сайта \"$sitename\""; | |
$message = "Имя: $name \nТелефон: $phone"; | |
mail($recepient, $pagetitle, $message, "Content-type: text/plain; charset=\"utf-8\"\n From: $recepient"); | |
?> | |
//Аякс отправка форм | |
//Документация: http://api.jquery.com/jquery.ajax/ | |
$("#callback").submit(function() { | |
$.ajax({ | |
type: "GET", | |
url: "mail.php", | |
data: $("#callback").serialize() | |
}).done(function() { | |
alert("Спасибо за заявку!"); | |
setTimeout(function() { | |
$.fancybox.close(); | |
}, 1000); | |
}); | |
return false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment