我有这个必须用 Ajax 处理的表单。
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<div class="column1">
<form class="form box" action="javascript:networkCheck();" method="post" enctype="application/x-www-form-urlencoded">
<h2>Fly!!</h2>
<table width="100%" id="fp_network_choice">
<tr><td style="border-bottom: 1px dashed #FFF;">Choose Network</td>
<td style="border-bottom: 1px dashed #FFF;"></td>
</tr>
<tr>
<td><input type="radio" name="network" id="vatsim" value="vatsim"> VATSIM</td>
<td><input type="radio" name="network" id="ivao" value="ivao"> IVAO</td>
</tr>
</tbody></table>
<div class="info" style="display:none" id="loading">Verifying status and flight plan, please wait...</div>
<div class="info" style="display:none" id="error">Goal</div>
<br><tr><td><input onclick="networkCheck()" id="check" type="submit" value="Check"></td></tr>
</form>
</div>
<script>
function networkCheck(){
var vatsim = 1;
var icao = 0;
ajax.open("POST","network_check.php",true);
ajax.onreadystatechange=function(){
if(ajax.readyState==4)
{
document.getElementById('error').style.display = 'block';
}
}
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.send("vatsim="+vatsim+"&ivao="+ivao);
document.getElementById('loading').style.display = 'block';
}
</script>
</head>
我收到此错误 Uncaught ReferenceError:ajax is not defined(重复 2 次)。我看到了 chrome 调试器的错误。
我不知道为什么?也许是 JQuery 版本???