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

Do I Need any JS Code to store any values to Local STorage if Im already mapping?

Im getting a json service response and mapping an id to a local storage item. Then Im mapping that local storage item to a request parameter attached to a different json service, but it seems that its either not storing the value or not getting the value or both. I thought I can just map the items.... Is that correct? or do I need to attach JS code in order to make this work?

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

Do I Need any JS Code to store any values to Local STorage if Im already mapping?

these are the screenshots what i did and the result in firebug:

Image Image Image Image

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

Do I Need any JS Code to store any values to Local STorage if Im already mapping?

the error above represents that an invalid 'id' was sent to the server and the server returned an error. therefore, i did not save and/or send to the server in the request parameter a valid 'id'. The storing and retrieving of the 'id' value is not passing.

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

Do I Need any JS Code to store any values to Local STorage if Im already mapping?

the next thing i tried was to add JS code to the incoming and outgoing items as follows:

JS for storing in the local storage Item:

localStorage.setItem('id',g);

JS for getting from the local storage Item:

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

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

Do I Need any JS Code to store any values to Local STorage if Im already mapping?

Ok, so can I get some help here? Thanks...

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

Do I Need any JS Code to store any values to Local STorage if Im already mapping?

Hi John - as you are receiving a response from the server, first of all check if you are receiving correctly an 'id' field.
As I can see on a screenshot above you getting an "400 Bad request" - that means that the request you sent to the website server was somehow malformed therefore the server was unable to understand or process the request.
The most common reason for a 400 Bad Request error is because the URL was typed wrong or something wrong with URL.

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

Do I Need any JS Code to store any values to Local STorage if Im already mapping?

I have already tested this service and works perfect when i manually enter it in...

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

Do I Need any JS Code to store any values to Local STorage if Im already mapping?

see below my success when i do a manual test on that service:

Image

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

Do I Need any JS Code to store any values to Local STorage if Im already mapping?

this is what happens when theres no id value:

Image

Return to “Issues”