How to pass values from one page to another in jquerymobile? [duplicate]

此生再无相见时 提交于 2019-12-13 19:52:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!