Get proper checkbox value using form.serialize
javascript, jquery, serialization
Solution
Yes. You can do it by adding a hidden input with the same name as checkbox which value will be submitted if checkbox is unchecked:
<input type="hidden" name="option" value="false"/>
<input type="checkbox" name="option" value="true"/>
It will submit both values if checkbox is checked. But server side will read the latest one (value of checkbox)
Problem
We are currently using `$('form').serialize()` to get all form information This will return any checkbox values as "On" or "Off". Is there any way to get a 1/0 or true/false value using this same method?