David7661654
Posts: 0
Joined: Sun Jul 26, 2015 9:18 am

using a local storage variable in javascript

Hello,

I defined a new javascript, in which I want to use a local storage variable called "destination".

The javascript I try to make is destinated to be used to convert a French e.164 number to a local number:
var dest={destination};
var formatted_destination = dest.replace(''+33","0");

The javascript doesn't accept the {destination}.

What should I do and how can I return the formatted_destination to a matching name local storage variable?

Thanks,

David

David7661654
Posts: 0
Joined: Sun Jul 26, 2015 9:18 am

using a local storage variable in javascript

I tried to run the following line in Javascript (run Javacript on button click), but it gives me a null value in the alert box:

alert(localStorage.getItem('destination'));

What am I doing wrong?

Thanks

David7661654
Posts: 0
Joined: Sun Jul 26, 2015 9:18 am

using a local storage variable in javascript

This doesn't work, either:

var dest = Apperyio.storage.storageVariable.get("$['destination']");
alert(dest);

David7661654
Posts: 0
Joined: Sun Jul 26, 2015 9:18 am

using a local storage variable in javascript

My bad.

I actually stored destination as a session storage, so to retrieve it in JS, I should have used

codealert(sessionStorage.getItem('destination'));/code

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

using a local storage variable in javascript

David,

Thank you for update.

Return to “Issues”