Friday, 23 August 2013

setInterval doesn't seem to re-execute php script

setInterval doesn't seem to re-execute php script

what i'm trying to do is get a variable to update every 5 seconds doing this:
setInterval(document.getElementById("listeners").innerHTML =
"<?php include('../includes/shoutcaststuff.php');
echo $dnas_data['CURRENTLISTENERS']; ?>",5000);
but what happens is the inner html is set but doesn't update every 5
seconds like it should. my guess is that the php only executes once, but i
have no idea if that's the case or not. and i'm aware i should make a
function to do the stuff inside setInterval... i'll clean up the code once
i figure out how to make it work. thanks in advance.

No comments:

Post a Comment