Cgridview CbuttonColumn button ajax call

Hi all,

I am trying to call an ajax function when the button is clicked, everything is ok except that the parameter is no passed.

This is the button definition (is visible $data->id == 5)

            'buttons' => array


                'aceptarAjax' => array


                    'imageUrl' => Yii::app()->request->baseUrl . '/images/iconos/system-tick-alt.png',

                    'ajax' => true,



                    .'"); }',


                    'options' => array('title' => 'Aceptar Invitación', 'alt' => 'Aceptar Invitación'),



And the testing ajaxUrl function

function ajaxUrl(_url)



return false;


shows an alert with /cmp/invitacion/ec//td/1

ec parameter should be 5 ¿how can I do it?

Any ideas?

Look is something with the quotes

Check the documentation for "buttons" -

You can use $data only in ‘url’ and ‘visible’ options… for the ‘click’ options this is not evaluated…


one idea would be to set the ‘url’ option to the desired url (use the $data)… and than in the click JS function you just read that value…

Great answer.

Solved with this.href