John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

how to pass data from an incoming json response to local storage, then back to my server?

and without that line code (looks like this):

var g=localStorage.getItem('id');

I get an error as well:

Image

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

how to pass data from an incoming json response to local storage, then back to my server?

so in either case, theres an error. I have no idea what that error is.... please help..??

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

how to pass data from an incoming json response to local storage, then back to my server?

heres the error if you have trouble viewing the pic:

TypeError: element is undefined
[Break On This Error]

locked: function() {

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

how to pass data from an incoming json response to local storage, then back to my server?

Image 2, original post, you are setting this:

code
localStorage.setItem('id', g)
/code

but there is no 'g' variable in the function.

The function gets passed 'value' (the actual value from from the service) and 'element' (UI component).

You should use 'value'. But you don't need to do that at all, just by mapping, the value will be set.

It's described in the docs: http://docs.appery.io/documentation/a...

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

how to pass data from an incoming json response to local storage, then back to my server?

ok well if i delete the JS for that one, and leave the JS on the one sending back to the server - i still get an error because when im submitting that page the server, its missing the value necessary to complete the submit_load service. The server returns back a false. I need a true response from the server

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

how to pass data from an incoming json response to local storage, then back to my server?

this popup represents a false response from the server. So im still not passing the selected item from the select menu..

Image

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

how to pass data from an incoming json response to local storage, then back to my server?

ok, well as i can tell after reading the documentation, i think my JS code is probably wrong. I deleted the the 1st JS since your saying by default by mapping it will be stored. Now, to return a value back to the server, my revised code looks like this:

localStorage.setItem('id, 'driver_name');
return id.toUpperString();

Please tell me whats wrong with this code?

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

how to pass data from an incoming json response to local storage, then back to my server?

i guess its supposed to be a getItem... i changed it, but still nothing has changed. And to be honest, I found the line code: return value.toUpperString();

in your documentation, but im not even sure what ...toUpperString(); means. I rewrote it like this and i still dont get it to work:

localStorage.getItem('id', 'driver_name');
return id;

so, can i get some help on this code?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

how to pass data from an incoming json response to local storage, then back to my server?

toUpperString() is a JavaScript function that converts string to all upper case. It's used as an example, you don't need to use it.

There is no method localStorage.getItem('id', 'driver_name'). It should be setItem. To get an item, you should use:

localStorage.setItem(key, value)

Local storage (and toUpperCase) is standard JavaScript browser API. I highly recommend you review it here: https://developer.mozilla.org/en-US/d...

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

how to pass data from an incoming json response to local storage, then back to my server?

Hi John - is there any errors in console with this changes?

Return to “Issues”