我最初有一個PHP郵件腳本準備好了,但服務器沒有PHP,所以我留下了搞清楚ASP。ASP在發送電子郵件後返回一個json數組
這裏是我的PHP代碼:
<?php
require_once('../class.phpmailer.php');
$mail = new PHPMailer();
$mail->SetFrom($email, $name);
$mail->AddAddress('[email protected]','john');
$mail->Subject = "A message from contact form";
$mail->MsgHTML($note);
if(!$mail->Send()) {
$the_return = array('request'=>'failed','prompt'=>$prompt);
echo json_encode($the_return);
} else {
$the_return = array('request'=>'success');
echo json_encode($the_return);
}
die();
?>
這裏重要的是嘗試並重新創建一個JSON數組的創建和編碼它。我將通過jquery ajax調用運行此腳本,所以我想將這些值返回給聯繫表單。
什麼JSON的輸出是什麼樣子? – AnthonyWJones 2012-02-16 21:48:20