Writing code in php and jQueryMobile.
I am trying to get a div to refresh based on a variable refreshTime
<div id="dynamicContent">
<em><?= $this->subtitle ?></em>
<img src="<?= $this->image ?>"/>
<em><?= $this->synopsis ?></em>
<br/> set refresh: <?= $this->refreshTime?> time on server: <?= date("H:i",time());?>
<h2><a href="<?=$this->irrelaventLink ?>"> More Details</a></h2>
</div>
<script>
setTimeout(function() {
$('#dynamicContent').load('/url/that/generates/plain/html/');
},<?= $this->refreshTime ?>*1000);
</script>
So this code will fire once and refresh the div dynamicContent after refreshTime has lapsed. The problem is that I want to keep refreshing with the new value of refreshTime that will be set once the refresh has happened.
I have scoured the web, looking for a jQuery Mobile way to do this, although if a jQuery way works I am happy to try that and see what that looks like on a mobile.
Note that the line:
<br/> set refresh: <?= $this->refreshTime?> time on server: <?= date("H:i",time());?>
Is only there for debugging
Any comments/thoughts/answers appreciated.
Cheers