tawheed
tawheed

Reputation: 5821

local storage data to server

I happen to have a feature on my web app that saves data into local storage, which I then convert into a json object. Is there a way for me to pass the local storage data to my server using ajax. I would like to have other clients of my web app access that data.

Upvotes: 1

Views: 2094

Answers (1)

Brant Olsen
Brant Olsen

Reputation: 5664

You would pass the localStorage values through ajax as you would any other parameters, like so:

 // jQuery ajax call.
 $.ajax({
   url: "test.html?jsonValue=" + localStorage.getItem("foo"),
 });

There is no special way of passing localStorage values around like there is for cookies.

Upvotes: 1

Related Questions