Chtml::ajaxbutton

Hi this is my view




<?php 

echo CHtml::ajaxButton(

        'Friend Request', 

 CController::createUrl('userFriendAPI/FriendshipRequest'), 

        array(

            'data'=>'js:{"ids" : "ABCD","YII_CSRF_TOKEN" : "'.Yii::app()->request->csrfToken.'"}',

            'type'=>'POST'

            ) 

        

);




?>



and this is my controller




class UserFriendAPIController extends JSONController{

    

    public function actionFriendshipRequest($action){

        

       

    }

}



when i press the button i got this error

I don’t know what is the problem any help please ???

paste your routing definitions from main config and tell the location of your controller file in project structure (defaul controllers directory or something different?)…

I didn’t get exactly what do you mean, can you please explain more

  1. you have some files in protected/config folder. those are configuration files. among them there is a main.php configuration file. You should have there ‘components’ section with ‘urlManager’ component. Copy and paste its configuration.

  2. Where is UserFriendAPIController defined? what is the file name and where did you put it (if not in standard protected/controllers directory)