jayR
06-29-2006, 09:57 AM
I've done a little bit with ajax, but hardly enough to really be comfortable with it. I have a simple script that is as follows:
<script>
var xmlhttp
function getInfo() {
if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
}
else{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
xmlhttp.open('GET', 'data.php', true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
document.getElementById("info").innerHTML = (xmlhttp.responseText);
}
};
xmlhttp.send(null);
}
setInterval("getInfo()",2000);
</script>
then farther down the document I have the div tag with the id=info and data.php just reads in a txt document that I've been manually changing to test with. The problem is that this works fine in Firefox but (as happens all to often) it won't work in IE. IE will updata it the first time through but after that it won't pick up any of my changes. I can't figure out what I did wrong, so I'm hoping some people here that are much wiser then I could see my mistake and point me in the right direction. Thanks.
I did notice that if I go into Tools, Internet Options, and Delete Files then it will get the next update. But then it will stop updating again. Its very frusterating.
<script>
var xmlhttp
function getInfo() {
if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
}
else{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
xmlhttp.open('GET', 'data.php', true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
document.getElementById("info").innerHTML = (xmlhttp.responseText);
}
};
xmlhttp.send(null);
}
setInterval("getInfo()",2000);
</script>
then farther down the document I have the div tag with the id=info and data.php just reads in a txt document that I've been manually changing to test with. The problem is that this works fine in Firefox but (as happens all to often) it won't work in IE. IE will updata it the first time through but after that it won't pick up any of my changes. I can't figure out what I did wrong, so I'm hoping some people here that are much wiser then I could see my mistake and point me in the right direction. Thanks.
I did notice that if I go into Tools, Internet Options, and Delete Files then it will get the next update. But then it will stop updating again. Its very frusterating.