Page 3 of 3

displaying completed tasks by user

Posted: Thu Mar 06, 2014 12:00 pm
by Nikita

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.


displaying completed tasks by user

Posted: Thu Mar 06, 2014 3:43 pm
by Shawn Johnson

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);


displaying completed tasks by user

Posted: Thu Mar 06, 2014 10:50 pm
by Illya Stepanov

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.


displaying completed tasks by user

Posted: Thu Mar 06, 2014 11:56 pm
by Shawn Johnson

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