ajax and gridview

hi everyone,

i want to put buttons in each row of the gridview that on click of each one it takes me to a controler action with and id of this specefic row , to do that i want on click of one of those buittons appears a costom confirm box (done by jquery) to do execute this action. but i don’t know how to redirect to a controller action on clik of that confirm(this confirm use a jquery script to test the click(yes or no) this is the link to the jquery script if you want to know ).

this is my crgid view code (the part that contain the buton declaration) :









                                   'click'=>'function() {



                jConfirm("Are you sure you want ot delete this thread?", "Confirmation Dialog", 

                function(r) {





		   type: "POST",

           url: "/easyspeed/index.php/essponsor/delete/11",

           success: function() { $("#sponsor-grid").yiiGridView.update("sponsor-grid"); },

           error: function() { alert("Ajax button failed"); }







the problem is in 2 parts :

1- the first part is how to pass each id in the ajax request(on click of corse).

2- the second is how to put the url that redirect to the action controller in the “url” parametter of “$.ajax()” ? the problem that the parametter “click” of the buttons attrebute avaluate a js script not a php script.i said that because i tryed to put Yii::app()->createUrl in the ‘url’ parametter of the ajax request but it is not evaluated.

wish you help me in this problem

As specified in the doc, you can use the variables $data and $row in the button expression:



 url: "'.CHtml::normalizeUrl('delete').'{\$data->id}"