title: jquery save json data object in cookie
body: <p>How do I save JSON data in a cookie?</p>
  
  <p>My JSON data looks like this</p>
  
  <pre><code>$("#ArticlesHolder").data('15', {name:'testname', nr:'4',price:'400'});
  $("#ArticlesHolder").data('25', {name:'name2', nr:'1', price:'100'});
  $("#ArticlesHolder").data('37', {name:'name3', nr:'14', price:'60'});
  </code></pre>
  
  <p>And I want to do something like</p>
  
  <pre><code>var dataStore = $.cookie("basket-data", $("#ArticlesHolder").data());
  </code></pre>
  
  <p>and to retrieve the data i want to load it into <code>$("#ArticlesHolder")</code> like</p>
  
  <pre><code>$.each($.cookie("basket-data"), function(i,e){
   $("#ArticlesHolder").data(i, e);
  });
  </code></pre>
  
  <p>does anyone know if I'm on the right track or should this be done in some other way? Simply put, how do i put and pull json data from a cookie?</p>