<?php
if (isset($_POST['add'])){
$a=$_SESSION["login"];
$b=$_POST["question"];
$query = "INSERT INTO vopros (user, question) values ('$a', '$b')";
mysql_query($query);
}
?>
$("#button-name").on("click", function(){
$("form").submit(function() { return false; });
$("#button-name").replaceWith("<em>отправка...</em>");
$.ajax({
type: 'POST',
url: 'mail_send/send.php',
data: $("form").serialize(),
success: function(data) {
if(data == "true") {
$("form").fadeOut("fast", function(){
$(this).before("<p><strong><center>Спасибо!</center></strong></p>");
});
}
}
});
});