Himanshu
Posts: 0
Joined: Mon Mar 31, 2014 9:46 am

Setting a local-storage variable via Service Mapping, but Not getting value of local Storage variable in java-script.

I am getting one problem, please help my to find out the solution.

I have one page, and there is one button on it.
On button click event (with Order = 1), I have created on Local storage variable, with null value (as I will fill value in it from the response of my rest-service).
On button click (with Order = 2) I am calling a web service and in the mapping, I assigned one of the response variable of that service to that local variable.
On Button Click (with Order = 3), I am calling a java script, and in that file, I have written the code to get that local-storage variable (var response = localStorage.getItem('_serviceResponseCode');), when I alert this variable I am not getting anything on it. It is null or undefined. Why ?? Please help me.
I am testing this on android phone as well on windows machine.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Setting a local-storage variable via Service Mapping, but Not getting value of local Storage variable in java-script.

Hi Himanshu,

This is too complex solution. You can simply invoke service on Click event and in mapping save the value in a localStorage variable, then run JS:
prealert(value);
return value;/preRead more here:
http://docs.appery.io/documentation/r...

Return to “Issues”