Currently when creating a FormData object, a checked checkbox is added with a value of \"on\", and an unchecked checkbox is not passed at all.
FormData
Do I have to
Try this:
var checkbox = $("#myForm").find("input[type=checkbox]"); $.each(checkbox, function(key, val) { formData.append($(val).attr('name'), this.is(':checked')) });
It always adds the field to FormData with either a value of true when checked, or false when unchecked.
true
false