hy Aman ...试试这个..
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#bt_sn").click(function(e) {
var to=$("#to").val();
var from=$("#from").val();
var message=$("#message");
//AJAX begins here
$.post("mail.php",{to_rec:to,from_rec:from,message_rec:message},function(data)
{
if(data=="SUC")
{
$("#result").html("Your mail has being sent successfully");
}
if(data=="FAI")
{
$("#result").html("Sending failed");
}
});
});
</script>
</head>
<body>
<input type="text" id="to" />
<input type="text" id="from" />
<textarea id="message">
<button id="bt_sn" >Send</button>
发送
</body>
</html>
现在在php方面...
<?php
$to=$_POST['to_rec'];
$from=$_POST['from_rec'];
$message=$_POST['message_rec'];
// Now use these variables in your mailing section
//Now if mailing is succedd at some part just echo the success or failure
if(mailed)
echo "SUC";
else
echo "FAI"
?>
祝你好运:P :)