I have a html file with few pages, and when a user press a button on a specific page, I’m loading a new html file that contain pages with the results.
The page loading work just fine, the problem is that i can’t manage to navigate between the new pages in the new html.
when i load the page manually on my browser, it work’s perfectly.
anyone got any idea why?
i think i need to perform a kind of refresh action to the page after the loading complete, but i don’t wont to do so, because the page retrieve data from a remote server, and i don’t know if the refresh action will try to retrieve the data from a remote server again(and that will duplicate the time the user will wait until he get an answer).
this is the code line i use:
$.mobile.changePage( “menu.php?q=”+query, { transition: “slide”} );
Thank you
... the problem is that i can't manage to navigate between the new pages in the new html.This line leads me to believe that you are attempting to return a multi-page template for a remote URL link (meaning the link you press doesn’t link to a pseudo-page on the same document, but rather another document all together). This is not allowed by default by jQuery Mobile (I think you can find a plugin for the functionality). jQuery Mobile only retrieves the first
data-role="pageordata-role="dialog"element from the returned external document.You can either use single-page templates, where each single pseudo-page is contained in its own document and you link to each of them via a normal URL (e.g. “/contact-us/index.php”)
OR
You can place all necessary pages in a single document, and link between them with hash based links (e.g. “#home”). When you do this, you can still retrieve data from a database, but you’ll have to create the code to do so via AJAX (and most likely binding to page-events).
OR
Maybe there is a plugin for this. If not, it’s actually not that difficult a thing to make, you just need to grab the external
data-role="page"elements by yourself rather than letting jQuery Mobile do it, add them all to the DOM, and then transition to the first one like normal.UPDATE
If you want to load multiple pseudo-pages at once, try this:
Note: This code is untested, please take this into consideration when using the code.