Crystal
Posts: 0
Joined: Mon Nov 25, 2013 8:49 am

localStorage.setItem, how to store multiple data?

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?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

localStorage.setItem, how to store multiple data?

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

Crystal
Posts: 0
Joined: Mon Nov 25, 2013 8:49 am

localStorage.setItem, how to store multiple data?

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).

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

localStorage.setItem, how to store multiple data?

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

Return to “Issues”