Hello, I'm a little confused on how to retrieve my JSON object from a different page. I believe I may be creating/storing it incorrectly and was hoping someone could steer me in the right direction. I am developing a PhoneGap application and using
LawnChair for light storage.
The JSON I am storing here
Page 1 (where I need to store the JSON) Snippet:
Code:
$.getJSON(serviceURL + 'getTaskDetails.php?id='+id, storeTasks);
function storeTasks(data) {
var tasks = Lawnchair({name:'tasks'},function(e){});
var taskList = data.tasks;
tasks.save({key:"task",value:taskList});
tasks.get("task",function(obj){
console.info(obj);
});
}
The console.info reads:
Quote:
key "task"
value Object { name="Level fireplace mantle", start_date="2012-01-22 00:00:00", created_by="rachel.rinaldi@gmail.com"}
|
How would I access task again from another page? I need to loop through the elements to create a list - but just trying to 'get' individual elements is not working.
Page 2 - Retrieval (Snippet)
Code:
Lawnchair(function(){
this.get('task', function(obj) {
console.info(obj);
})
})
The above returns the object, but won't let me reference individual elements (ex: I've tried obj.name or obj.tasks.name or obj.Object.name all result in "undefined") Any suggestions on what I'm doing wrong?