<script type="text/javascript">
function Ajax(){
var xmlHttpReq=null;
if(window.ActiveXObject){
xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest){
xmlHttpReq=new XMLHttpRequest();
}
xmlHttpReq.open("GET","text.php",true);
xmlHttpReq.onreadystatechange=RequestCallBack;
xmlHttpReq.send(null);
function RequestCallBack(){
if(xmlHttpReq.readyState==4){
if(xmlHttpReq.status==200){
document.getElementById("resText").innerHTML=xmlHttpReq.responseText;
}
}
}
}
</script>
</head>
<body>
<input type="button" value="Ajax提交" onclick="Ajax()" />
<div id="resText"> </div>
</body>
</html>
index.html:21 XMLHttpRequest cannot load file:///F:/%E8%81%8A%E5%A4%A9%E5%AE%A4/text.php. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.Ajax @ index.html:21
柠檬酸钠
相关分类