ClearifyHosting
11-07-2006, 06:26 PM
Hello,
I coded a AJAX script that autoupdates a chat script every second in a div called "autoupdate".
It detects if there are any updates on the "chat" - and if there is, it updates it appropriately.
The problem is, that it works perfectly on FireFox, but doesn't in IE6/7. It seems to only update with an older cached version.
The code is attached below (it might have a bit of PHP in it).
If someone could help out - I'd really appreciate it.
var oldText;
function loadurl(dest) {
try {
xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
}
xmlhttp.onreadystatechange = triggered;
xmlhttp.open("GET", dest);
xmlhttp.send(null);
}
function triggered() {
if (oldText != xmlhttp.responseText) {
if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
document.getElementById("autoupdate").innerHTML = xmlhttp.responseText;
oldText = xmlhttp.responseText;
'.$scrollTo.'
}
}
}
function update () {
loadurl("'.$path.'classes/autoupdate.php?'.$idaction.'='.$_GET['type'].'&'.$idsubaction.'='.$_GET['handler'].'");
t = setTimeout ("update ()",1000);
}
I coded a AJAX script that autoupdates a chat script every second in a div called "autoupdate".
It detects if there are any updates on the "chat" - and if there is, it updates it appropriately.
The problem is, that it works perfectly on FireFox, but doesn't in IE6/7. It seems to only update with an older cached version.
The code is attached below (it might have a bit of PHP in it).
If someone could help out - I'd really appreciate it.
var oldText;
function loadurl(dest) {
try {
xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
}
xmlhttp.onreadystatechange = triggered;
xmlhttp.open("GET", dest);
xmlhttp.send(null);
}
function triggered() {
if (oldText != xmlhttp.responseText) {
if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
document.getElementById("autoupdate").innerHTML = xmlhttp.responseText;
oldText = xmlhttp.responseText;
'.$scrollTo.'
}
}
}
function update () {
loadurl("'.$path.'classes/autoupdate.php?'.$idaction.'='.$_GET['type'].'&'.$idsubaction.'='.$_GET['handler'].'");
t = setTimeout ("update ()",1000);
}
