ajax部分:
$.ajax({
type:"post",
url:"{:url('Contact/sendEmail')}",
data: "username=" $("#username").val(),
//dataType:'json',
success: function (data) {
alert(data);
}# }
})
thinkphp部分:
##//發送郵件public function sendEmail(Request $request){
$data = $request->param(); //回傳訊息
$name = $data['username'];
##報錯問題:
#未定義陣列索引: username
#