1

I have a piece of code which works well in Mozilla but doesn't in Chrome.

 function yoxi(){
    var xhr = new XMLHttpRequest;
    xhr.open("GET", "yoxi.php", false);
    xhr.send(null);
}

function getirus(){
    var xhr = new XMLHttpRequest;
    xhr.open("GET", "getirus.php", false);
    xhr.send(null);
    document.getElementById('onlineus').innerHTML=xhr.responseText;
}

setInterval(yoxi, 5000);
setInterval(getirus, 5000);

setinterval doesn't work in Chrome repeatedly. What may be the problem?

Brian Tompsett - 汤莱恩
  • 5,195
  • 62
  • 50
  • 120

1 Answers1

3

Try this:

setInterval(function() {
    yoxi();
}, 5000);

setInterval(function() {
    getirus();
}, 5000);
kakajan
  • 2,302
  • 2
  • 17
  • 37