I am working with the JQuery validate plugin. All my validation works fine, but I am having difficulties passing the selected values of checkbox's to my PHP file. At the moment I have
var validator = $("#my_form").validate({
rules: {
'checkbox[]': {
atLeastOneChecked: true
}
},
messages: {
'checkbox[]': {
atLeastOneChecked: jQuery.validator.format("Please select at least one type of switch")
}
},
submitHandler: function (form) {
$.ajax({
type: "POST",
url: "php/process.php",
data: {
'checkbox[]': $("#checkbox").val()
},
dataType: "json"
}).done(function (response) {
});
return false;
}
});
How can I pass the selected checkbox options in my submitHandler? I know I could just send a serialized form, but I have to submit data separately.
Thanks
Aucun commentaire:
Enregistrer un commentaire