Abhishek
Abhishek

Reputation: 33

having issue with localstorage while accessing it back

I am having problem with localstorage.I am using payment gateway for my ecommerce site.Before moving on to the payment gateway I save my item to cart with the help of local storage.When I get reply from payment gateway my localstorage automatically get clean or null. What can be the possible problem. I am saving a list in localstorage code

 var shopp = [];
shopp is a array of items
 localStorage["listShoppingCart"] = JSON.stringify(shopp);

this listShoppingCart always gets empty

Upvotes: 0

Views: 80

Answers (1)

Scott Anderson
Scott Anderson

Reputation: 1371

Try

localStorage.setItem('listShoppingCart', JSON.stringify(shopp));

Also is your domain and protocol the same before and after the payment gateway? E.g. If you go from http before to https after then the localStorage will be different

Upvotes: 1

Related Questions