i've got an ajax script that updates an image, by checking a dynamically modified text file (the reasoning behind this is complicated, but valid)... only thing is, my code doesn't work in IE 6.0.2900.2180 (the only IE i've tested in)
it simply refuses to update... but it works fine in FF
here's the axaj javascript file:
Code:
var req;
if(window.XMLHttpRequest){
//For Firefox, Safari, Opera
req = new XMLHttpRequest();
}
else if(window.ActiveXObject){
//For IE 5
req = new ActiveXObject("Microsoft.XMLHTTP");
} else if(window.ActiveXObject){
//For IE 6+
req = new ActiveXObject("Msxml2.XMLHTTP");
}
else{
//Error for an old browser
alert('Your browser is not IE 5 or higher, or Firefox or Safari or Opera');
}
var lastResponse="";
function handleResponse(){
if(req.readyState == 4 && req.status == 200){
//returned text from the PHP script
var response = req.responseText;
if(response)
{
if (response != lastResponse)
{
document.getElementById("album_cover").src = response;
lastResponse = response;
}
}
else
{
lastResponse = "";
}
}
}
function refreshData()
{
req.open("GET","ajaxTarget.php", true);
req.send(null);
req.onreadystatechange = handleResponse;
setTimeout('refreshData()', 3000);
}
refreshData();
any ideas why i'm having no luck?