IBM Worklight - 多页面应用中的导航错误 [英] IBM Worklight - Navigation errors in a multipage app
问题描述
我正在使用jQuery Mobile在IBM worklight中开发混合应用程序。
I am developing a hybrid application in IBM worklight using jQuery Mobile.
我的应用程序文件夹结构如下:
My application folder structure is like this:
- carbikepooling.html(在jquerymobile app中创建的默认文件)
- pages文件夹,包含文件:ownerProfile.html,passengerProfile.html,createPool.html
此外,validateForm.js与carbikepooling.html相关联,ownerProfile.js与ownerProfile.html相关联,createPool.js与createPool.js相关联。
从carbikepooling.html,我将页面更改为置于pages文件夹中的ownerProfile.html:
validationForm.js(与carbikepooling.html相关)
From carbikepooling.html, I change page to ownerProfile.html placed in the pages folder: validationForm.js (associated with carbikepooling.html)
function redirectToProfile(profileId, profileType){
if(profileId == null || profileId == ""){
$("#failMessage").fadeIn();
}
else if(profileType == "Owner"){
var dataurl = '?profileID='+profileId;
$("#failMessage").fadeOut(200, function(){$("#loginSuccess").fadeIn(function(){$.mobile.changePage('pages/ownerProfile.html'+dataurl, {transition: "slide"});});});
}
else{
var dataurl = '?profileID='+profileId;
$("#failMessage").fadeOut(200, function(){$("#loginSuccess").fadeIn(function(){$.mobile.changePage('pages/passengerProfile.html'+dataurl, {transition: "slide"});});});
}
}
一切正常。
现在,我在ownerProfile.html文件中,从这个文件,当我将页面更改为createPool.html文件放置在同一页面文件夹中时:
Now, I am in the ownerProfile.html file, from this file, when I change page to createPool.html file placed in the same pages folder as:
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文件,因为创建的路径是为了找到文件错误如下:
Problem is that this time, the createPool.html file is not loaded because the path created to locate the file is wrong as:
GET http://192.168.42.239:10080/CarBikePooling/apps/services/preview/CarBikePooling/common/0/default/pages/pages/createPool.html
正如你所看到的那样<$ URL中的c $ c> pages 会显示两次,我不明白为什么。
As you can see that the pages
in the URL is shown two times, I don't understand why.
推荐答案
<你没有在问题中指明app结构中的pages文件夹在哪里。
You did not specify in the question where is the pages folder in the app structure.
假设它是这样的:
apps\
--- yourApp\
------ android\
------ iphone\
------ common\
--------- css\
--------- js\
--------- my.html
------ pages\
--------- my1.html
--------- my2.html
--------- my3.html
我认为这是因为一旦你<$来自主HTML文件的c $ c> changePage ,该文件位于 apps \ yourApp \ common
您现在位于 apps\yourApp\pages
...
I think it's because once you changePage
from the main HTML file, which is at apps\yourApp\common
you are now in apps\yourApp\pages
...
因此,当您想要从页面中的文件移动时\
到 pages \
中的另一个文件,因为您已经在 pages \
,只需调用HTML文件即可。含义,
So when you want to move from a file in pages\
to another file in pages\
, since you are already in pages\
, simply call to the HTML file. Meaning,
更改此:
$.mobile.changePage('pages/createPool.html'+dataurl1, {transition: "slide"});
对此:
$.mobile.changePage('createPool.html'+dataurl1, {transition: "slide"});
或者,升级并返回,意味着: ../ pages / createPool.html
。
Alternatively, go a level up and back in, meaning: ../pages/createPool.html
.
这篇关于IBM Worklight - 多页面应用中的导航错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!