For example in html, I have a form that contains check-boxes :
<label>
<input type="checkbox" name="check" value="check1">Option A
</label>
<label>
<input type="checkbox" name="check" value="check2">Option B
</label>
And an AJAX call like this:
$.ajax({
data: $(#form).serialize(),
type: $(#form).attr('method'),
url: $(#form).attr('action'),
datatype:'html',
success: function() {
...
}
});
Since serialze() gives values like check=check1&check=check2 , the value of check only contains check2, the later assignment. Is there a way to get all checked values in an array?
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire