I’ve got an Interval which runs a function every 3 Seconds.
intervalStepper = window.setInterval('intervalTick()','3000');
function intervalTick() {
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
gotResult(xmlhttp.responseText);
}
}
xmlhttp.open('GET','index.php?ajax=true',true);
xmlhttp.send();
}
function gotResult(res) {
alert(res);
}
Also, I have just another Ajax Call, which runs on button click.
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
agentDetailGotten(xmlhttp.responseText);
}
}
xmlhttp.open('GET','index.php?anotherPage=true',true);
xmlhttp.send();
Now, if I run the second code just in time when the interval ticks and executes the first call, the calls actually run at about the same time. But then it seems like the interval dies somehow – he doies not tick anymore.
Is this a known problem or am I just not seeing something big…
Thanks for help!
I’ve solved it just now.
It seems this is something like a firefox bug (found on bugzilla.mozilla.org)
NS_ERROR_NOT_AVAILABLE
This one was not shown to me, but I’ve just found now. It appears when Firefox tries to execute two calls at the same time.
For more Information, I found a blog entry here
I solved it that if one call is running, the other one waits.