浏览 6224 次
锁定老帖子 主题:能否给个XMLHTTP异步响应的例子
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2004-06-14
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2004-06-14
摘自Microsoft XML SDK 2.6 - XML Reference 一段例子:
The following JScript/HTML example specifies the the handler HandleStateChange gets called when an XMLHttpRequest object's readyState property changes. A button on a page is enabled when readyState indicates that all data has been received (readystate == 4). <script> var xmlhttp=null; function PostOrder(xmldoc); { var xmlhttp = new ActiveXObject("Msxml2.XMLHttp");; xmlhttp.Open("POST", "http://myserver/orders/processorder.asp", false);; xmlhttp.onreadystatechange= HandleStateChange; xmlhttp.Send(xmldoc);; myButton.disabled = true; } function HandleStateChange(); { if (xmlhttp.readyState == 4); { myButton.disabled = false; alert("Result = " + xmlhttp.responseXML.xml);; } } </script> |
|
返回顶楼 | |
发表时间:2004-06-14
写错了.
xmlhttp.Open("POST", "http://myserver/orders/processorder.asp", false); 第三个参数是isAysnc,表示是否异步.这里应该是true才对。 |
|
返回顶楼 | |