How to solve the setinterval problem that only updates the first time

Asked

Viewed 82 times

0

This giving only the first automatic refresh after. Follows what I am using

    var refresh = setInterval( function() 
{
    $('#uohide').load('rand.php');
}, 5000);

html <div id="uohide></div>

Rand.php <? echo rand(1, 9999); ?>

  • 2

    Why do you think he only runs once? You’ve tried putting console.log('chamou!); within the setInterval to test?

  • 1

    I guess in that case would be better to use setTimeout as callback of this load.

  • 1

    Another thing to see is if the page is always receiving a message cached of Rand.php; $('uohide').load('rand.php?_=' + new Date().getTime());

  • Boy was that, it already solved, but how can I be removing the cache of . php is only in htacces?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.