javascript - i am storing an array in sessionstorage and retrieving through sessionstorage. I am getting the data but i am unable to repeat the array -


var x=[ { "xyz":1, "abc":"dashboard", "def":0, }, { "xyz":2, "abc":"facility", "def":0 }] 

this original data.then storing data using session storage below---

$window.sessionstorage.setitem("useritems", json.stringify(x)); 

then retrieving data using sessionstorage---

$window.sessionstorage.getitem("useritems") 

i getting data correctly--

 [{ "xyz":1, "abc":"dashboard", "def":0, }, { "xyz":2, "abc":"facility", "def":0 }] 

but unable repeat data , displaying data.

you need wrap json.parse() :

json.parse($window.sessionstorage.getitem("useritems")); 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -