views:

105

answers:

1

So I think jStorage is what I need to solve one of my problems. It needs JSON to be working with jQuery, so I've tried including it, but it doesn't seem to work. I have no idea what JSON is actually. Here's my code (jQuery is loaded higher). It doesn't even show the alert window.

<script type="text/javascript" src="jquery.json-2.2.min.js"></script>
<script type="text/javascript" src="jstorage.js"></script>
<script type="text/javascript">
$.jStorage.set(key, 'test');  
value = $.jStorage.get(key);
alert("test"+value);
</script>

What could cause this?

+2  A: 
$.jStorage.set('key', 'test');  
value = $.jStorage.get('key');
alert("test"+value);

See http://www.jstorage.info/#usage: key needs to be string otherwise an exception is thrown

bogdanvursu
Yep, thanks! Hadn't see this.
Maxime