【发布时间】:2014-01-05 13:12:13
【问题描述】:
我正在使用 IBM Worklight Studio 版本_6.0.0.20130926-2018。
在我的应用程序中,我使用的是 jQuery Mobile 框架。
我的问题是,当我尝试使用$.mobile.changePage 加载data-role="page" 时,页面不会自行刷新。当我刷新此页面时,JavaScript 代码不起作用。
相反,我收到以下错误:
ReferenceError: WLJQ is not defined profile.html:11
TypeError: $ is undefined jquery.mobile-1.3.2.js:28
ReferenceError: $ is not defined profile.js:3
ReferenceError: WL is not defined
$.mobile.changePage 代码:
//redirect to profile
function redirectToProfile(profileId){
if(profileId == null || profileId == ""){
$("#failMessage").fadeIn();
}
else{
var dataurl = '?profileID='+profileId;
$("#failMessage").fadeOut(200, function(){$("#loginSuccess").fadeIn(function(){$.mobile.changePage('pages/profile.html'+dataurl, {reloadPage : true,transition: "slide"});});});
}
}
});
如何在 Worklight 中解决这个问题?
【问题讨论】:
-
删除
reloadPage强制加载整个 HTML 标记。如果加载的页面没有在 head 标签中加载必要的库,它将无法工作。
标签: javascript jquery-mobile ibm-mobilefirst