Page 1 of 1

localStorage.setItem, how to store multiple data?

Posted: Tue Dec 17, 2013 4:12 am
by Crystal

Conditions in "where" there is more than one, so my Response message has more than one, how to get these information is stored in the local.

For instance, I have two ID, ID=101,ID=102.

select name from table where ID=101
select name from table where ID=102

I want both of the name are stored in the local _name (like: John,Mike).
How to do?


localStorage.setItem, how to store multiple data?

Posted: Tue Dec 17, 2013 4:15 am
by maxkatz

You can store in two different local storage variables: id1, id2 or use format like this to store in one variable:

{id1, id2}

it could really be in any format that makes sense to you


localStorage.setItem, how to store multiple data?

Posted: Tue Dec 17, 2013 5:15 am
by Crystal

Hello,
I don't want to store id1 and id2 in two different local storage variables. In fact, id1 and id2 are also in the ID array.What I really want to do is how to store the name1 and name2 in the local as "_name" (like: John,Mike).


localStorage.setItem, how to store multiple data?

Posted: Tue Dec 17, 2013 5:18 am
by maxkatz

It's entirely up to you how and in what format to store the data. Just use the browser API to store the data and achieve the format that you need: a href="http:/eintohtml5.info/storage.html" rel="nofollow"http:/eintohtml5.info/storage.html/a