我正在使用 IBM Worklight Studio version_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 中解决此问题?
最佳答案
如果我理解正确的话,您创建了另一个导航到的 HTML 页面。这不是使用 Worklight 时进行导航的正确方法。 Worklight 是一个单页面应用程序!,因此您需要使用 div 元素来切换内容,而不是在页面之间导航。 有关这方面的更多信息可以在这里找到: http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v610/03_02_Building_a_multi_page_application.pdf
关于javascript - IBM Worklight 6.0.0.1 - JavaScript 未在 jQuery Mobile 多页应用程序中执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20933948/