jquery - how to pass data from one page to another using query in iPhone phone gap application -
in application, have 2 pages, page1 , page2. in page1, have 1 text field , 1 label. want pass these 2 values page1 page2 , insert them text 2 labels respectively when click on submit button. i'm new phonegap , jquery. how can achieve using jquery , javascript?
{ var name = document.getelementbyid("usernametextfield").value; //textfield var fullname = document.getelementbyid("namelabel").innerhtml; //label localstorage.setitem("username", name); localstorage.setitem("fullname1", fullname); var getusername = localstorage.getitem("username"); var getname = localstorage.getitem("fullname1"); fullnamelabel.innerhtml = getname.value; //label usernamelabel.innerhtml = getusername.value; //label }
you can use localstorage achieve this. new in html5, allows persistent storage client-side.
localstorage uses key/value pairs.
localstorage.setitem("key-name", itemdata);
localstorage.getitem("key-name");
localstorage.removeitem("key-name");
Comments
Post a Comment