yes i thought i invoked the service before like you said and didnt work. Well, i did exactly as you said and now it works. Thanks.
yes i thought i invoked the service before like you said and didnt work. Well, i did exactly as you said and now it works. Thanks.
I have the $ sign for the response array, but how do I reference it in JS?
Here's my mapping, and it works fine:
Now, I'd like to use that in a piece of JS similar to this:
var response = JSON.stringify(data));
localStorage.setItem("json_response", response);
I'm guessing that "data" above should be "$" or something, but I haven't figured out how to make it work.
Hello! $ sign isn't connected with variables names in mapping. If you use your code on service success then variable where you retrieve entire responce is called "data". This code is correct:
codevar response = JSON.stringify(data));
localStorage.setItem("json_response", response); /code
If you want to add JS in mapping then value you map will be in "value" variable (no matter what field you map)
I guess the part that is giving me trouble is that I am thinking all 4 fields under the $ sign could be saved as part of one arrayed variable.Would this be possible?
Hello! This is how it would be - will be saved an array containing 4 records.
Hi,
I must be missing something dumb. Here's what I have, trying to use a local variable called 'testIt':
var response = JSON.stringify(data);
alert(response);
localStorage.setItem(testIt, response);
alert(testIt);
The first alert works with a nice string of all the data from the service, which is cool to see working, but the second alert does not return anything. Nothing happens, like it is not even there. I tried a few different combinations of quote marks and such, but with no luck.
BTW - Thanks for you help
Hi,
Here is the code:
codevar response = JSON.stringify(data);
alert(response);
localStorage.setItem( "testIt", response ); //you don't have "testit" variable so place "testit" in quotes to declare this is a string
alert( localStorage.getItem( "testit" ) ); //read saved data here./code
Thank you! Thank you! That is exactly what I was missing.
How to load listview with stored response data?
Hello! Could you clarify your question?