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?

hi, Im first populating a selectmenu from a json list, then i want to store the value the user selected in local storage, then i want to use that value to send back to the server along with other elements. I'm using the following codes:

This code to grab from the json response and store the value:

Code: Select all

         localStorage.setItem('id',g); 

And this code to send back to the server:

Code: Select all

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

Are these the right codes to do this?

see below for snapshots:

Image Image Image Image

This is the Resulting Page, its now not even loading the select menu anymore, its crashing on arrival (its frozen with the progress bar keep running)...

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?

The code looks fine but none of the images are showing...

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?

thats strange because i can see them on my screen no problem, try my link:

https://getsatisfaction.com/apperyio/...

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?

Check if there are any error in the console.

In mapping, you need to do:

code
...
return g;
/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?

well if the codes are good, then that means somehow i didnt map them right or something else. i did everything exactly as shown in your tutorial. i thought this instruction was very straight forward..

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?

can you be more specific? where does that line go?

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?

well i added that line to the code that sends back and the final looks like this:

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

and heres the error with this code: Image

Return to “Issues”