Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-08-2012, 03:48 PM   PM User | #1
RachelR
New to the CF scene

 
Join Date: Apr 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
RachelR is an unknown quantity at this point
Exclamation Get JSON Obj from Lawnchair on different page

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?
RachelR is offline   Reply With Quote
Reply

Bookmarks

Tags
json, lawnchair, phonegap

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:02 AM.


Advertisement
Log in to turn off these ads.