jQuery post array
<p>Am wondering how to post an array using $.ajax. My array is something like this:</p>

<pre><code>var a = new Array();
a['test'] = 1;
a['test2'] = 2;
and so on...
</code></pre>

<p>I tried:</p>

<pre><code>$.ajax({
  url: baseUrl+"chat.php",
  data: { vars: a},
  type: 'post',
  success: function(data) {
alert(data);
}});
</code></pre>

<p>Any suggestions? Thank you for your time.</p>
