Jquery mobile 在ChangePage之后调用函数
我有两个页面,方法名是changepage index2.html。。。在这个页面中,我想调用数据库并动态填充listview,但我无法调用函数,我们只是更改页面 在主页上,我有以下脚本:Jquery mobile 在ChangePage之后调用函数,jquery-mobile,cordova,Jquery Mobile,Cordova,我有两个页面,方法名是changepage index2.html。。。在这个页面中,我想调用数据库并动态填充listview,但我无法调用函数,我们只是更改页面 在主页上,我有以下脚本: $(document).live( 'pageinit',function(event){ $("#changePageButton").click(function() { $.mobile.changePage("index2.html", { transition: 'sl
$(document).live( 'pageinit',function(event){
$("#changePageButton").click(function() {
$.mobile.changePage("index2.html", { transition: 'slideup'});
});
在index2中
$(document).live( 'pageinit',function(event){
alert("OK");
});
但从不显示警报您使用的是哪个版本的jQ和jQM<代码>.live在jQ 1.7之后替换为
.on
。您是否将index2.html代码放在该页面的head
标记中?如果是,则在body
tag内取出$.mobile.changePage
仅加载正文
而忽略其他内容。我使用jquery-1.8.3和jquery.mobile-1.3.0,我在头上和头上尝试…我尝试使用.live和.on…但不工作尝试pageshow
并将代码放在index2.html中,在第一次data role=page
之后。现在它可以工作,但如果我再次返回,会显示警报。。。如果我返回到索引2,则向我显示两次警报…谢谢您可以使用$(document).off('pageshow')。on('pageshow',函数
)终止以前的绑定。