How can I attach an action to a checkbox or a select, that will be executed every time I click the checkbox or select the option?
I need this to perform an AJAX request.
Use this:
$("input[type='checkbox']").click(function(){
//code for ajax request
});
in the code for ajax request, if you want to know whether the checkbox is checked, use $(this).is(':checked')
Assuming you're using CHtml::checkBox() to generate the checkbox, an example would be:
CHtml::checkBox($name, false, array ('ajax'=>array(
'type'=> 'POST',
'url' => $url,
'success'=> 'function(data) {
// callback function code here
}'
)))