Jquery multipage html

I ran into the problem of trying to link multiple multi-page html files with jQuery mobile and found that when using ajax, jQuery mobile does not display the full document and not the first page.

I searched for the problem and found todd thomsons subpage widget but couldn't get the plugin to work. So now I'm trying to figure out, without using ajax, is it possible to load an external multi-page html file but not leave the ios web app window and run safari?

I've seen this bit of javascript in my searches, but I'm not sure how it will turn out.

<a href="file2.html" data-icon="back" data-ajax="false" class="file2">Log Out</a></li>

$(document).bind('pageinit', function() {
  $('.file2').click(function (event) {
    event.preventDefault();
    window.location.assign("file.html");
  });
});

      

So I guess my question is, with javascript, is it possible to load an external HTML file without leaving the web application view?

+3


source to share


1 answer


If I understood your question correctly (you need to change the page to file.html

, which is a multi-page jQM doc) you can try

<li><a href="file1.html" rel="external" data-icon="back">Log Out</a></li>

      

or if you need to programmatically change the page



<li><a id="logout" href="#" data-icon="back">Log Out</a></li>

      

and

$(document).on('pageinit', '#logout', function() {
  $('#logout').click(function (event) {
    event.preventDefault();
    $.mobile.ajaxEnabled = false;
    $.mobile.changePage("file1.html");
  });
});

      

+1


source







All Articles