我的ie中为什么跑不了ajax?
<P>代码如下是ajax 基础编程里的例子,都跑不起来.<BR>//simpleResponse.xml文件<BR>Hello from the server!<BR>//就以上一行文字在这个文件里.<BR><BR>//以下是simpleResponse.html文件,两个文件在同一个目录中,为执行的就是这个文件,为什么readyState取不到4,书上的所有例子都这样.是不是我配置有问题?请教了.<BR><BR><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<BR> "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" target="_blank" >http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</A>"><BR><html xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank" >http://www.w3.org/1999/xhtml</A>"><BR><head><BR><title>Simple XMLHttpRequest</title><BR> <BR><script type="text/javascript"><BR>var xmlHttp;</P><P>function createXMLHttpRequest() {<BR> if (window.ActiveXObject) {<BR> xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");<BR> } <BR> else if (window.XMLHttpRequest) {<BR> xmlHttp = new XMLHttpRequest();<BR> }<BR>}<BR> <BR>function startRequest() {<BR> createXMLHttpRequest();<BR> xmlHttp.onreadystatechange = handleStateChange;<BR> xmlHttp.open("GET", "simpleResponse.xml", true);<BR> xmlHttp.send(null);<BR>}<BR> <BR>function handleStateChange() {<BR> if(xmlHttp.readyState == 4) {<BR> if(xmlHttp.status == 200) {<BR> alert("The server replied with: " + xmlHttp.responseText);<BR> }<BR> }<BR>}<BR></script><BR></head></P>
<P><body><BR> <form action="#"><BR> <input type="button" value="Start Basic Asynchronous Request" onclick="startRequest();"/><BR> </form><BR></body><BR></html></P>
我也出现这个问题了~~
AJAX需要配置服务器吗?怎么配置呀?
我的IIS已经装了,可是还是运行不了。
页:
[1]
