I am developing a hybrid application in IBM worklight using jQuery Mobile.
My application folder structure is like this:
- carbikepooling.html (default file created in jquerymobile app)
- pages folder, contain files: ownerProfile.html, passengerProfile.html, createPool.html
Also validateForm.js is associated with carbikepooling.html, ownerProfile.js with ownerProfile.html, createPool.js with createPool.js
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"});});});
}
}
This works fine.
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 (associated with ownerProfile.html file)
$(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)");
}
});
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
As you can see that the pages
in the URL is shown two times, I don't understand why.