Ajax を使用して、php ファイルを介して mysql データベースの一部のデータを変更しています。PHPファイルが「OK」または「ERROR」をエコーするようにコードを書きました。alert(ret) で確認しましたが、正常に動作しています。しかし、問題は if (ret=="OK") にあります。このステートメントには入りません。誰でも私を助けることができますか?
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById('Store_cards_action_form_close').click();
ret = xmlhttp.responseText;
if (ret=="OK"){
alert("Congratulations. Transaction Successful.");
document.location.reload();
}
else{
alert("You have Insufficient Coins to buy this Card!");
}
}
}
xmlhttp.open("GET","script_card_transaction.php?" + para,true);
xmlhttp.send();