get value from lawnchair in different page

194 views Asked by At

Page1:

var done=Lawnchair({adapter:"dom",name:'done'},function(e){
console.log("storage open");
})
var obj1='false';
done.save({key:'1',value:obj1});

Page2:

Lawnchair({adapter:"dom",name:'done'},function(e){
this.get('1', function(obj) {
console.log('object is: ' + obj);
alert(obj.value);
 })

I am getting the error TypeError:obj is null

1

There are 1 answers

0
paolooo On

TypeError:obj is null means that Lawnchair done db was not yet created. If it does it would display and alert false.

Do confirm that you we're able to create a done db.

var done=Lawnchair({adapter:"dom",name:'done'},function(e){
    console.log("storage open");
});

var obj1='false';
done.save({key:'1',value:obj1}, function(k) {
    console.log(k)
});

After you saved key:'1' it will out the object data. If it won't, double check if you have included the dom.js adapter.