我是 wordpress 主题开发的新手,我需要在 wordpress 中发送一封带有 ajax/PHP 的电子邮件
var dataString = 'name=' + name +
'&email=' + email +
'&contact=' + contact +
'&technology=' + technology +
'&budget=' + budget +
'&details=' + details;
alert(dataString);
$.ajax({
type: "POST",
url: "<?php bloginfo('template_url'); ?>/qoute-sent.php",
data: {name:'anas', Email: 'anas@yahoo.com'},
datatype: "html",
success: function() {
alert(sent);
}
所有代码都可以工作,alert(dataString);
但在那之后 ajax 不起作用....
这是我的 php 文件代码
$name=$_POST['name'];
$email=$_POST['email'];
// $contact=$_POST['contact'];
//$technology=$_POST['technology'];
// $budget=$_POST['budget'];
//$details=$_POST['details'];
//-------------for email setup----------------------------
$to = "stylegurupk@gmail.com";
//------------------------------------------
$message = " \n " .
"Name ".$name." \n " .
"Email : ".$email." \n " ;
//----------------------------------
$subject = "MWM Qoute Request";
$headers = 'From: '.$email . "\r\n" .
'Reply-To: '.$to . "\r\n" .
'X-Mailer: PHP/' . phpversion();
//echo "TO : ".$to."<br>";
//echo "FROM : ".$email."<br>";
//echo "<br>".$message;
mail($to, $subject,$message,$headers);