Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>... the problem is that i can't manage to navigate between the new pages in the new html.</code></p> <p>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 <code>data-role="page</code> or <code>data-role="dialog"</code> element from the returned external document.</p> <p>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")</p> <p><strong>OR</strong></p> <p>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).</p> <p><strong>OR</strong></p> <p>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 <code>data-role="page"</code> 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.</p> <p><strong>UPDATE</strong></p> <p>If you want to load multiple pseudo-pages at once, try this:</p> <pre><code>//hijack link clicks on links with the `click-hijack` class $(document).on('click', '.click-hijack', function () { //show loader $.mobile.loading('show'); //create AJAX request for pseudo-page(s) $.ajax({ url : $(this).attr('href'), dataType : 'html', success : function (response) { //hide loader $.mobile.loading('hide'); //get the pseudo-page(s) from the AJAX response var $pages = $(response).find('[data-role="page"], [data-role="dialog"]'); //append the pseudo-page(s) to the DOM //(this may need to change if you are using a framework like ASP.NET as they can add wrapper DOM elements) $("body").append($pages); //now that the pesueo-page(s) is/are in the DOM, we can transition to them normally $.mobile.changePage('#' + $pages.eq(0).attr('id')); }, error : function () { //don't forget to handle errors } }); //stop the default behavior of the link, as well as propagation of the click event return false; }); </code></pre> <p>Note: This code is untested, please take this into consideration when using the code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload