[jQuery] send checkboxes array
Hi,
I would like send array of checkboxes with the same name
<input type="checkbox" name="cities[]" value="city1" />
<input type="checkbox" name="cities[]" value="city2" />
<input type="checkbox" name="cities[]" value="city3" />
my javascript code:
...
var tagsArray = new Array();
jQuery("input:checked").each(function(id) {
message = jQuery("input:checked").get(id);
tagsArray.push(message.value);
...
jQuery.post("post.php",{
tags: tagsArray, /// I can not use tags[]: tagsArray -
javascript error "missing : after property id"
}, function(xml) {
...
and it generates POST:
tags=city1&tags=city2&tags=city3
and should be:
tags[]=city1&tags[]=city2&tags[]=city3
how can I do that?
Thanks
bogo