I’m trying to learn to develop with Phonegap and JQM. My app is very simple: it loads a list of persons with a jqm ajax call and if a person is clicked, it’s supposed to take you to another page.
I have tried to load the second page in many ways:
1.- By adding following
$.mobile.changePage($('myDiv'));
2.- By adding following
$.mobile.changePage('myPage.html');
3.- By using a normal href inside the link tags
The only solution that works is the last one, which flips badly. So i really want to do it with the JQM changePage, which allows me to put some transition animation, and when i press the link i always get a the “
E/Web Console(10922): Uncaught SyntaxError: Unexpected identifier at
file:///android_asset/www/index.html:2″ ERROR
any ideas?
EDIT: I was able to make it work with only with the third method (using the href inside the anchor tag). After some testing I am convinced that the error comes out only when i call a method using the onclick event in the anchors. Someone knows why this is happening?
Solved. The error came up only when i used the “onclick” event to change page by script. By Using the jquery live function and listening for “click” events everything worked fine. I still haven’t found the reason why the onclick event gave me that error, if someone knows it would be nice to know. Thanks to everyone who tried to help.
for people who wants the code:
HTML at creation:
Population scripts after a ws call:
script after page load for the click listener that DID work: