JQuery Mobile works by βgrabbingβ a page and loading content and entering it on the page.
This seems to create a problem when I try to inject other content on the page.
I have my index.html and then the page2.html file. I set up jquery mobile in the usual way, wrapping the contents of each page in a div like this:
<div id="container" data-role="page"> // my content <a href="page2.html">go to page 2</a> </div>
when the user goes to page 2, he performs a good slide effect. The URL in the location bar looks like this: index.html # page2.html
jquery mobile enters the content of the page using anchors and applies a transition. good, so everything works fine until the next part.
On page2.html, I have a section that loads some external data and enters it into a div.
<a href="http://www.somedomain.com/myata.php" class="ajaxtrigger" data-role="none">mydata</a> <div id="target"></div> <script src="js/code.js"></script> <script src="js/loader.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('.ajaxtrigger').trigger('click'); }); </script>
The problem I am facing is that when I enable transitions in jQuery mobile, this script does not work. It will not load data in a div. bummer.
Does anyone know what I need to do to get it to run and load content into this div?
source share