Return to Snippet

Revision: 53222
at November 16, 2011 21:48 by stur


Initial Code
<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}]}"

Initial URL

                                

Initial Description
Default adapter saves to DOM.

Initial Title
Lawnchair persistant localstorage example JSON

Initial Tags
javascript, jquery, json

Initial Language
JavaScript