Find us on facebook

Aug 1, 2014

Call AJAX function when checkbox change

echo CHtml::checkbox("actions[]",true, array("value"=>"$keydes-$Authitem"));


<?php
Yii::app()->clientScript->registerCoreScript('jquery');
Yii::app()->clientScript->registerScript('updateAction', '
$(":checkbox").change(function()
{
var value =$(this).val();

var check = $(this).attr("checked");


$.ajax({

 url: "' . Yii::app()->createAbsoluteUrl('rights/Authitemchild/Update').'",
 type:"POST",
 data: "value="+value+"&check=" + check,
 //dataType:"json",
 success: function(responce)

 {
alert(responce);

 }

});

});

',CClientScript::POS_READY);
?>


No comments:

Post a Comment