How to send multiple checkbox group values through ajax?

I am having three group of check boxes as follows:

echo '<input type="checkbox" name="metal[]" value="'.$value.'" id="'.$value.'" onclick="return submitForm()" ><label for="'.$value.'"></label>';
echo '<input type="checkbox" name="shape[]" value="'.$value.'" id="'.$value.'" onclick="return submitForm()"><label for="'.$value.'" ></label>';
echo '<input type="checkbox" name="type[]" value="'.$value.'" id="'.$value.'" onclick="return submitForm()"><label for="'.$value.'" ></label>';

All coming from database. I want to send these values through ajax. My current code is:

`function submitForm() {
var form = document.myform;

var dataString = $(form).serialize();
$.ajax({
type:'POST',
url:'carousel.php',
data: dataString,
success: function(data){
    $('#myResponse').html(data);


}
});
return false;
}</script>`

This function is sending only single value to carousel.php. I further want to process data and show result according to the checked values. Also on clicking another checkbox, previous checkbox values is lost. I found above code on google and very new to ajax. Please help.

This should help

One noticeable difference is the checkbox names

This helped. Thanks a lot.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.