Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

displaying completed tasks by user

Hello.

Good way to pass object into localStorage is:

code
var objectToPass = {someVariable: "somvalue"};
var objectToPassStr = JSON.stringify(objectToPass);
localStorage.setItem("yourLSV", objectToPassStr);
/code

And for get this object from lsv use following code:

code
var objectToPassStr = localStorage.getItem("yourLSV", objectToPassStr);
var objectFromLSV = JSON.parse(objectToPassStr);
/code

Regards.

Shawn Johnson
Posts: 0
Joined: Wed Jan 15, 2014 4:17 pm

displaying completed tasks by user

I am getting an error 400 bad request when I try to make the updates to the user_chall collection

Image

Here is my payload

Image

here is my code for pointer objects
var temp = '{"collName": "challdata", "_id":"'+localStorage.getItem("Users_ID")+'"}';
console.log(temp);
return JSON.stringify(temp);

var temp1='{"collName":"challdata","_id":"'+localStorage.getItem("selected_id")+'"}';
console.log(temp1);
return JSON.stringify(temp1);

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

displaying completed tasks by user

Hi Shawn,

Two moments you should notice in your implementation:
1). When you save pointer field you need to pass OBJECT instead of the string. Therefore, remove stringify.
2). Please take a look on your Payload and compare it with request we have suggested you. And try to find the mistake.

Shawn Johnson
Posts: 0
Joined: Wed Jan 15, 2014 4:17 pm

displaying completed tasks by user

Thank you guys for your help with this I know i asked a lot of questions.

Return to “Issues”