today i was doing some javascript and was using AJAX for a form.

in the web form, i had a field type checkbox, so when i would submit the form, the POST information would always be the value of the forms.

for example. this is how the checkbox input field looks like:

<input type="checkbox" id="agree" name="agree" value="1">

so normally, if you have check the checkbox, then the default value would apply, in this case 1,

but even after submitting the form without checking the checkbox, the value would still be 1?

what am i doing wrong? OK, i finally found out what i was doing wrong. in my javascript code i had declared the value of my ajax field to the value instead of checked so i changed it and it worked:

BEFORE:
var terms = document.getElementById('terms').value;

AFTER:
var terms = document.getElementById('terms').checked;

do you see the difference?