My code:


         echo CHtml::ajaxButton ("All",CController::createUrl('user/grantAllRoles',array('user'=>$model->idUser)), 

                    array('type' => 'POST',

                          'data' =>array('userrole'=>$model),  





My browser answer:

you’re not allowed to perform this action.


Add acces in your user controller

public function accessRules()


		return array(

			array('allow',  // allow all users to perform 'index' and 'view' actions






Hmmm, I don’t think this is the problem, but CreateUrl is not a static method, you can’t call it like this.

You should use $this->createUrl(), or Yii::app()->createUrl()

Also, you may check your UserController accessRules

check the below code this may help you.

<?php echo CHtml::ajaxSubmitButton(Yii::t('job','Create Job'),CHtml::normalizeUrl(array('job/addnew','render'=>false)),array('success'=>'js: function(data) {



                    }'),array('id'=>'closeJobDialog')); ?>

Solved.thanks a lot guys