问题
Possible Duplicate:
jQuery mobile passing parameter from one page to another
I need to pass values from one page html to another html page. what is the best way to pass the value. can anyone explain me how to achieve this.
回答1:
you can pass the variables through forms, urls and session. You can use all the methods you use in existing web applications to pass data from 1 page to another. or you can utilize the local storage of HTML5 which is a modern and faster way of storing the secure data
localStorage.lastname="Smith";
document.getElementById("result").innerHTML="Last name: "+ localStorage.lastname;
You can find more information about HTML5's local storage on the following link
http://www.w3schools.com/html5/html5_webstorage.asp
回答2:
You can use the html5 local or session storage api to store the small data across the pages.
To set the value on session storage
window.sessionStorage.setItem('key', 'value');
and to get the value
sessionStorage.getItem('key');
来源:https://stackoverflow.com/questions/10477905/how-to-pass-values-from-one-page-to-another-in-jquerymobile