How to save my data when I refresh page?

I want to save my progress bar with text around it, when I refresh page. I try to save session storage but without result.

Upvotes: 0

Views: 209

Answers (2)

Austin
Austin

Reputation: 1291

You should be able to retrieve your value from session storage like this:

var data = sessionStorage.getItem('votPoints');

Upvotes: 0

Jeoff
Jeoff

Reputation: 99

Using the sessionStorage API, you can retrieve the value of your key using

sessionStorage.getItem('votPoints');

This will return a string so you might want to convert it back to JSON if you're going to use it within Javascript.

Upvotes: 1

Related Questions