jquery mobile – loadPage问题

我无法通过jQuery-mobile加载页面将我的下一页加载到“ contentdiv

我已将页面剪切为基础,这是代码。

index.html:

     JQuery Mobile Load Page Test      
$( "#nextPage" ).on( "click", function() { $.mobile.loadPage("nextPage.html", { pageContainer: $('#containerTest') }); });

nextPage.html

 

this is the next page

我不认为你可以在另一个页面内加载一个页面,你可以试试这样的东西:

 $(document).on('pageinit', function(){ $( "#nextPage" ).on( "click", function(){ $('#containerTest').load('nextPage.html [data-role="content"]',function(){ $('.ui-page-active').trigger('create'); }); }); }); 

这将从容器内的第2页加载内容(

),然后它将触发原始页面上的create事件以增强加载的内容