How do I pass a variable like username between two jQueryMobile pages?
or two regular pages for that matter, having the variable as global does not work, since at th
I usually go with local storage, you can store objects too. Ex:
var userInfo = {
"username": "Bob",
"roleName": "Admin",
"image": "img/userPic.jpg",
};
//Store the object in local storage
localStorage.setItem('loggedUser', JSON.stringify(userInfo));
then on the other page you can simply do:
var userInfo = JSON.parse(localStorage.getItem("loggedUser"));
var userName = userInfo.username;