Thursday, 15 August 2013

JQuery Mobile JS script runs first time but not when returning to page

JQuery Mobile JS script runs first time but not when returning to page

I have a JQuery Mobile page set up as such:
<body>
<div class="normal" data-role="page" data-title="Photo Stream">
<script type="text/javascript" src="js/photostream.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Cordova to load
document.addEventListener("deviceready", onDeviceReady,
false);
// Cordova is ready
function onDeviceReady() {
}
</script>
<div id="programholder">
~~addtional HTML~~
The external JS script photostream.js works when the app first opens, but
then wont work again if I return to this page. I am assuming this is due
to how AJAX loads the pages on top of each other, but seeing as my
external link was within the data-role="page" div I assumed this got
triggered each time that element reappeared.
Is there a way to have the external JS file reload again whenever this
page is re-visited?

No comments:

Post a Comment