扫码关注官方订阅号
var counter = xmlHttp.responseXML.getElementsByTagName("count")[0].firstChild.data;
业精于勤,荒于嬉;行成于思,毁于随。
function startCallback(){ if(xmlHttp.readyState == 4){ if(xmlHttp.status == 200){ setTimeout("pollServer()",5000); refreshTime(); } } } function pollServer(){ var url = "DynamicUpdateServlet.php?task=foo" + counter(); createXMLHttpRequest(); xmlHttp.open("GET",url,true); xmlHttp.onreadystatechange = pollCallback; xmlHttp.send(null); } function counter(){ var res = "&counter="; var count = xmlHttp.responseXML.getElementsByTagName("count")[0].firstChild.data; res += count; return res; }
pollServer() 中调用counter() 要放到 createXMLHttpRequest();前面
可以通过使用PHP的XMLReader内置类获取
XMLReader
http://www.jb51.net/article/80437.htm
两种方法 一:解析XML 二:正则匹配
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
pollServer() 中调用counter() 要放到 createXMLHttpRequest();前面
可以通过使用PHP的
XMLReader内置类获取http://www.jb51.net/article/80437.htm
两种方法 一:解析XML 二:正则匹配