I have multiple pages (php files) in my mobile app. I use the same head for all of them: include('myhead.php'); at the start of all other files that contains mainly the CDN of jQuery and jQuery mobile. Last line of myhead.php is </head><body>
The php files have mixed content (php+html). In one of the pages, I have a navbar with an ul inside with a hrefs where I call a php file with arguments. When I do that, my app opens a new browser and messes up my app by doing that. I tried adding to the a href the data-ajax="false" but that solves the browser thing only to leave me with another problem: document.ready does not fire in the destination page.
So I am in a pickle here. I have no idea how to proceed. I need the document.ready to fire since I have a lot of elements in the destination page that need to be dynamically filled with data on pageshow (document.ready).
The code: page0.php
<?php
...some code here session and mysql stuff
$myid = some number;
include('myhead.php');
?>
<script>
// some jquery functions here
</script>
.. page body content here
.. and at the end I have the footer
<footer data-role="footer" data-position="fixed">
<div data-role="navbar" class="ui-body-a">
<ul>
<li>other hrefs</li>
<li><a href="page1.php?id1=<?php echo $myid?>" data-rel="external"</a></li>
</ul>
</div>
</footer>
</body>
</html>
Now the code for page1.php
<?php
$mynewid = $_REQUEST['id1'];
...some code here
include('myhead.php');
?>
<script>
function func1(){
// some processing here
}
$(document).ready(function(){
// important processing here that dynamically populates controls on the page
});
</script>
.. page body content here, controls that should be populated with data on document.ready
</body>
</html>
Is there a way to include the page2 ALL document.ready functions in the myhead.php in a script there? Would it be taken into consideration for my page? Would that mess up something? Please advise.
As I said , I need the app to behave like a native app, and not to throw me out on new browser windows...