现在已经可又实现点提交出现xxx.xml中的内容,想实现自动5秒刷新内容,比如我改了xxx.xml中的内容,但是页面上的内容并没有改变。
好像是两个问题:
1、如何自动定时重新获取xxx.xml中的内容,显示出来。
2、听说浏览器好像有个缓存功能,相同文件只读一次,要怎么办呢?
————————————————————-————————————————
var xmlHttp;
function createXMLHttpRequest(){
if (window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (windown.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}
}
function startRequest(){
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET","xxx.xml",true);
xmlHttp.send(null);
}
function handleStateChange(){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
document.getElementById('results').innerHTML = xmlHttp.responseText;
}
}
}