我正在对一个ajax文件执行POST请求。让我们称它为A.php
然后,这个A.php文件将调用B.php。
$.ajax({
type: "POST",
url: "../../page_components/A.php",
data: { // my data
},
success: function(response) {
location.reload();
},面临的问题:当A.php也调用B时,不会调用成功函数。如果A.php不调用B.php,它就能正常工作
在我的A.php上
/* some stuff that a.php does
*/
include ('B.php'); // call B.php to handle other stuffB.php
<?php
require '../../../../PHPMailer/class.phpmailer.php';
require '../../../../PHPMailer/class.smtp.php';
// set relevant agency email to send to. $agency comes from A.php
switch ($agency) {
case "1": $receiverEmail = "xxx@hotmail.com";
break;
case "2" : $receiverEmail = "zzz@gmail.com";
break;
}
$mail = new PHPMailer();
// All the mail setting and stuff is here...
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
?>发布于 2016-04-07 06:38:47
url: "../../page_components/A.php"这是我应该在B.php上发送的网址吗?如果是这样的话,网址就不应该是这样的
url: "../../page_components/B.php"https://stackoverflow.com/questions/36467957
复制相似问题