【发布时间】:2015-10-22 08:00:33
【问题描述】:
我在查询移动设备中有一个多页模板。如何在单击超链接或按钮时刷新当前页面?我正在使用 JQM 1.4.5 版
我已尝试使用how to refresh(reload) page when click button in Jquery mobile 中建议的以下代码,但是它没有按预期工作:
// Refresh the store main page - experimental
$(document).on('click', '#aStoreReload', function (event) {
$.mobile.changePage(window.location.href, {
allowSamePageTransition: true,
transition: 'none',
showLoadMsg: false,
reload: true // tried reloadPage: true also
});
});
它将返回到带有 URL 的主页。我的意思是本地服务器中的http://localhost:56235/main.html#storeMainPage。但是,JsBin 显示的是空白页,而jsfiddle 什么也不做。点击商店链接可以看到有刷新按钮的页面。
如何正确刷新页面(视图)?
编辑
我也在点击事件中尝试了以下脚本:
$.mobile.changePage($("#storeMainPage"), { transition: 'slidedown' });
$(document).pagecontainer("load", "#storeMainPage", { reload: true });
第一个like什么也不做,第二行给出一个错误Uncaught Error: cannot call methods on pagecontainer prior to initialization; attempted to call method 'load',这是正常的,因为我们在初始化之前调用了pagecontainer。
【问题讨论】:
标签: javascript jquery html css jquery-mobile