Beginner - Problem updating div with jquery mobile
Hi,
I have some real time data I want to show on ever page in my site. I use the following code to update it every 5 seconds.
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#qdata').load('/qdata.php');
$('#qdata').trigger('create');
}, 5000);
</script>
qdata.php just spits out a html table. The sidebar includes a div with id="qdata".
The code works almost all the time, except when I navigate to a page in a sub folder. If I visit that page directly, it works, but not if I navigate to it! I can see from the browser debugger however that no errors occur and the page is certainly called, just the div is no longer updated. Most weird. I guess it has something to do with the way jquery mobile loads pages.
I tried various .trigger, .page, etc. that I saw mentioned elsewhere, but cannot get it to work reliably. I also lose the formatting when updating.
The examples I looked at seem to indicate the above should work OK. Can anyone point me in the right direction?