2012-08-03 72 views
0

我有一个列表视图,当用户点击时,一个changePage发生到一个loadPage,当它完成加载后,切换到带有changePage的文章页面。将内容追加到另一个页面上的div,JQM

我的问题:加载是好的,但是,我似乎无法将内容追加到文章页面的div,我不是那么好的网页编程,但它可以让页面不知道关于该div,因为它尚未加载页面?追加后div仍为空。

这是我如何追加:

$("#tmpId").load(url + " article", function() { 
    $('#loadedPageContent').append($(tmpId + " article").html()); 
} 
$.mobile.changePage("loadedArticle.html", {transition:"pop"}); 

澄清:#tmpId是位于装载页面一个div,#loadedPageContent位于最后一篇文章页面上。

回答

0

把你

$("#tmpId").load(url + " article", function() { 
    $('#loadedPageContent').append($(tmpId + " article").html()); 
} 
$.mobile.changePage("loadedArticle.html", {transition:"pop"}); 

$(document).delegate('#page_id_on_loadedArticle', "pageinit", function() { 
    //code here... 
} 

使loadedArticle.html加载完成后,它将运行。

+0

非常感谢,这解决了我的问题! – Oberheim 2012-08-07 08:10:55

相关问题