So I have been trying to use an ajax button to rate something up and down but I can’t quite get the syntax right. This is what I have so far that I have gotten out of a tutorial:
<?php
Chtml::ajaxButton (
'Up', //Label on the button
'array("rate")', // this the url of the proccess file... or use call the action function of the current controller.
'type' => 'post' // method type Post or GET
'data' =>array($model-id, Yii::app()->user->id, "1"), // Data you want to send to controller.. must be in array
'success' => 'function(data) { Thank you }',
);
?>
I basically want to process my form with the rate action in my current controller and than print out thank you once it has been processed. What am I doing wrong here?
Ok so I got it to work to a point now, but I can’t access the variables am sending to my controller. Here is my new code: