/ Published in: JavaScript
Default adapter saves to DOM.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script type="text/javascript" src="js/lawnchair-0.6.1.min.js"></script> <script> $(document).ready(function() { var viewData = new Lawnchair({name:'testing'}, function(viewData) { var me = [{"name":"ie7","y":12.8},{"name":"ie9","y":19.8},{"name":"opera","y":7.4},{"name":"firefox","y":17.4},{"name":"firefox3","y":10.6}]; viewData.save({key:'data',options:me}, function(obj){ console.log(obj) }); viewData.get('data', function(me) { console.log(me.options); }); //console.log(store.get(me)); }); }); </script> //localstorage, data = "{"options":[{"name":"ie7","y":12.8},{"name":"ie9","y":19.8},{"name":"opera","y":7.4},{"name":"firefox","y":17.4},{"name":"firefox3","y":10.6}]}"