Checkbox value in ajax request of yii

This is one of the way to send data dynamicallay in ajaxbutton request of yii.
When you click on ajaxbutton We will get the selected checkbox value and send this via ajax

<?php Yii::app()->clientScript->registerScript('checkBoxSelect', "
function callData(){
 fileid= $(\"input[name='usergroup[]']:checked\").map(function() { 
            return this.value; 
       return 'id='+fileid;


<?php echo CHtml::ajaxButton('User',CController::createUrl('user/active'), 
          'type' =>'POST',
          'data'=>"js:callData()", //or append data here
          'url'=> 'user/active',

Leave a Reply

Your email address will not be published. Required fields are marked *