I want to programmatically change my jquery mobile page. I have read stackoverflow pages here
https://stackoverflow.com/a/24173950/4278933
jQuery mobile pagecontainer load()
and failed to get my code working. Sometimes I get an error on the console, sometimes I get nothing (no url change, gui change or console log output).
(Note, I am navigating TO f.html which is an external page).
All attempts to change the page are done AFTER device ready...
First method I tried was
<a href="f.html" id="front" data-rel="external" data-ajax="false">Front</a>
and then I triggered
$("#front").trigger("click");
With the above, nothing worked (no error or url change). However, manually clicking on the link achieved the page change I wanted.
Then I read http://api.jquerymobile.com/pagecontainer/#method-change and combined with the two SO posts noted above, I tried
$( ":mobile-pagecontainer" ).pagecontainer( "load", "f.html" );
and also tried
$( "body" ).pagecontainer( "load", "f.html");
I get Error: cannot call methods on pagecontainer prior to initialization; attempted to call method 'load'
Where am I going wrong?