January 14, 201214 yr Hi All, Okay this ones bugging the hell out of me... the following code WORKS in I.E. and it even works in my friends Firefox browser... but on my own firefox browser, it runs init once and then refuses to repeat? I have tried debugging it and have got it down to the point where its adding "xmlhttp.send();" that stops it. If I remove that line then everything works fine?? Can anyone please give advice? function init(){ alert ("init"); var xmlhttp; 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) { var response = xmlhttp.responseText; if (response == "1"){ loadInterface(); }else{ } } } xmlhttp.open("GET","LiveAssistanceHandle.php?PickedUp=check&refresh=" + (new Date().getTime()),true); xmlhttp.send(); setTimeout("init()",2000); } window.onload = init;
January 14, 201214 yr Author checked it on brothers comp too which is firefox, and works fine for him too? Could this be something to do with browser version?
January 14, 201214 yr Something simple like this may solve your problem setTimeout(function(){init();}, 2000);
Create an account or sign in to comment