我正在使用jQuery Mobile在IBM worklight中開發混合應用程序。IBM Worklight - 多頁應用程序中的導航錯誤
我的應用程序文件夾結構是這樣的:
- carbikepooling.html(默認文件中jquerymobile創建的應用程序)
- 網頁文件夾中,包含的文件:ownerProfile.html,passengerProfile.html,createPool.html
也validateForm.js與carbikepooling.html相關,ownerProfile.js與ownerProfile.html,createPool.js與createPool.js
從carbikepooling.html,我改變頁面ownerProfile.html放置在網頁文件夾: validationForm.js(與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放在同一個頁面的文件夾爲:
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
顯示兩次,我不明白爲什麼。
此問題已解決。在問這個問題之前,我已經嘗試了您的解決方案,但沒有任何反應所以,我如何調試這個如下:我寫 - $ .mobile.changePage('../ pages/createPool.html'+ dataurl1,{transition:「slide」});它完美的工作。 – himanshu206
不錯。我已經更新了答案以反映這一點。 –
好的!謝謝..... – himanshu206