You can serialize the data as JSON, like this:
$.cookie("basket-data", JSON.stringify($("#ArticlesHolder").data()));
Then to get it from the cookie:
$("#ArticlesHolder").data(JSON.parse($.cookie("basket-data")));
This relies on JSON.stringify()
and JSON.parse()
to serialize/deserialize your data object, for older browsers (IE<8) include json2.js to get the JSON
functionality. This example uses the jQuery cookie plugin