Return checkboxes array to php via jquery?
<p>Im trying to send an array of checkboxes (value) to PHP via jquery. How can that be done?</p>

<p>See the following example:</p>

<pre><code>&lt;input type="checkbox" name="option[]" value="0"&gt; Small
&lt;input type="checkbox" name="option[]" value="1"&gt; Medium
&lt;input type="checkbox" name="option[]" value="2"&gt; Large
&lt;input type="checkbox" name="option[]" value="3"&gt; X-Large

&lt;input id="ButtonAdd" type="button" value="Add" /&gt;
</code></pre>

<p>jQuery code, couldn't get to work:</p>

<pre><code>$("#ButtonAdd").click(function() { 
    var options = $("input:checkbox[name='option[]']");
     $.post("ajax_extras.php", { options:options  },
       function(data)  {
         console.log(data)
    });
});
</code></pre>

<p>ajax_extras.php file:</p>

<pre><code>&lt;?php
 print_r($_POST['options']);
?&gt;
</code></pre>
