I\'m using simplecartjs to power an online store. It stores it\'s data in local storage, which looks like this:
{\"SCI-1\":{\"quantity\":1,\"id\":\"SCI-1\",\
Or you could let http://rhaboo.org do the heavy lifting and write:
var store = Rhaboo.persistent("My Cart");
if (store.cart === undefined)
store.write('cart', []);
//otherwise it must have data in from before
$("#matkahuolto").click(function(){
store.cart.push ({
"quantity":1, "id":"Toimituskulut",
"price":5, "name":"Toimituskulut" });
});
$("#show").click(function(){ console.log(
store.cart.map(function (i) {
return i.quantity + " " + i.id + "s at " + i.price + " each"
}).join(' plus '); );
});
BTW, I wrote rhaboo.