I have a below checkbox in my phtml
file
<input type="checkbox" id="my_checkbox" name="my_checkbox">
Below code is used to pass params to controller file
$('checkbox_id').observe('click', function(e) {
var checked = this.checked;
});
new Ajax.Request("<?php echo $formAction;?>", {
method: 'post',
postBody: "mypostdata="+$('my_value').value,
onComplete: function(data) {
var mydata = data.responseText.evalJSON(true);
$('shopping-cart-totals-table').update(mydata);
}
});
How can I check if the checkbox is clicked or not and pass its vale in postBody
as params to my controller file ?
For example,
If checkbhox clicked, value = yes/true If not, value = no/false
How can I pass the aboove value, based on user's click as params ?
Thanks