Jquery mobile IBM Worklight-多页应用程序中的导航错误
我正在使用jQuery Mobile在IBM worklight中开发一个混合应用程序 我的应用程序文件夹结构如下所示:Jquery mobile IBM Worklight-多页应用程序中的导航错误,jquery-mobile,ibm-mobilefirst,Jquery Mobile,Ibm Mobilefirst,我正在使用jQuery Mobile在IBM worklight中开发一个混合应用程序 我的应用程序文件夹结构如下所示: apps\ --- yourApp\ ------ android\ ------ iphone\ ------ common\ --------- css\ --------- js\ --------- my.html ------ pages\ --------- my1.html --------- my2.html --------- my3.html carb
apps\
--- yourApp\
------ android\
------ iphone\
------ common\
--------- css\
--------- js\
--------- my.html
------ pages\
--------- my1.html
--------- my2.html
--------- my3.html
- carbikepooling.html(在jquerymobile应用程序中创建的默认文件)
- 页面文件夹,包含以下文件:ownerProfile.html、passengerProfile.html、createPool.html
此外,validateForm.js与carbikepooling.html关联,ownerProfile.js与ownerProfile.html关联,createPool.js与createPool.js关联
ownerProfile.js(与ownerProfile.html文件关联)
$(document).undelegate('#crtPool', 'click').delegate('#crtPool', 'click', function() {
if(update1 == 1 && update2 == 1){
var dataurl1 = '?profileID='+profileId+'&name='+userName;
$.mobile.changePage('pages/createPool.html'+dataurl1, {transition: "slide"});
}
else{
alert("Oops! You have not updated all of your information. To create pool, first update your info (click the settings icon on the right top)");
}
});
问题是,这次没有加载createPool.html文件,因为为定位该文件而创建的路径错误,如下所示:
GET http://192.168.42.239:10080/CarBikePooling/apps/services/preview/CarBikePooling/common/0/default/pages/pages/createPool.html
正如您看到的,URL中的
页面显示了两次,我不明白为什么。您没有在问题中指定应用程序结构中的pages文件夹在哪里
假设是这样的:
apps\
--- yourApp\
------ android\
------ iphone\
------ common\
--------- css\
--------- js\
--------- my.html
------ pages\
--------- my1.html
--------- my2.html
--------- my3.html
我认为这是因为一旦你从主HTML文件中更改页面
,该文件位于apps\yourApp\common
中,你现在就进入了apps\yourApp\pages
因此,当您想从pages\
中的一个文件移动到pages\
中的另一个文件时,由于您已经在pages\
中,只需调用HTML文件即可。意思是
更改此项:
$.mobile.changePage('pages/createPool.html'+dataurl1, {transition: "slide"});
为此:
$.mobile.changePage('createPool.html'+dataurl1, {transition: "slide"});
或者,向上返回一级,意思是:。/pages/createPool.html
此问题已解决。在问这个问题之前,我试过你的解决方案,但什么也没发生。因此,我如何调试它如下:我写-$.mobile.changePage('../pages/createPool.html'+dataurl1,{transition:“slide”});它工作得非常完美。