title: How can you send an object using jQuery's .data() method?
body: <p>I'm not sure this is possible, but...</p>
  
  <p>Let's say I have the following object:</p>
  
  <pre><code>var myData = { 1 : 1. 2 : 2 }
  </code></pre>
  
  <p>How can I attach the object to the following url, using jQuery's .data method.</p>
  
  <pre><code>$('.link').html('&lt;a href="#" data-test="' + myData + '"&gt;test&lt;/a&gt;');
  </code></pre>
  
  <p>If I bind a click function to the following url, I should be able to retrive <strong>myData</strong></p>
  
  <pre><code>$('.link a').on('click', function(e) {
      $(e.currentTarget).data('test');
  })
  </code></pre>
  
  <p>But it's not working... i get a string value called: ["object Object"]</p>
  
  <p><strong>So i am thinking, I need to prepare the -myData- object before I send it using jQuery's .data method.</strong></p>
  
  <p>Any ideas?</p>