<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
一個Ajax簡單例子,那里錯了?就是沒反應!
慕粉小奮青
2016-06-30 17:55:02