是否有任何人知道为什么没有工作? 希望得到任何帮助。
这是超文本
Enter Code:<br/><input type="text" name="code" id="code"/><br/>
<input type="button" id="confirm" value="Confirm" onClick="confirm()"/>
这就是PHP(基本上获得用户投入的价值,如果与变量相同的话)。
$code = $_POST["code"];
$a = 105678;
if($code==$a){
echo "sucess";
} else {
echo "nosucces";
}
Java:(简单地用麻ja或无ces的na)
function confirm () {
$.post(
"confirm.php",
{code:$(this).val() },
function(data) {
if(data== sucess ) {
alert("yay");
} else {
alert("nay");
}
}
);
}
basically on all occasions the ouput is nay on further debugging i tried an elseif statement on the javascript asking if data is equal to nosucces but it didn t even alert anything, meaning it s not getting the data from the php