我有這個輸入字段。AJAX呼叫響應沒有顯示任何內容
<input type="email" name="email" required/>
當點擊提交按鈕,它進入:
$(".store_email").click(function()
{
var ajax_url_store_email = "store_email.php";
var value= document.getElementsByName('email')[0].value;
$.post(ajax_url_store_email, {act:"Subscribe", value:value}, function(e){
console.log(e);
});
});
,呼叫被髮送到:
$email=$_POST["value"];
$verify= $link->query(" INSERT INTO `Subscribers_email`(`email`) VALUES ('$email') ");
if($verify==true)
{
return json_encode("Success!");
}
else
{
return json_encode("Something went wrong!");
}
一切工作正常,但此調用不返回任何東西。我的意思是console.log(e);
什麼都不打印,可能是什麼原因?
請檢查您的AJAX –
嘗試回聲和退出,而不是在PHP代碼的回報 – Chintan