Ajax Request On Clicking Custom Button In Cgridview


I was trying to create a custom button which will modify database. I was using cgridview and created custom button. However, when I click the button, the database does get modified but the request is a normal post request and not an ajax request…

here’s what I;m doing


<?php $this->widget(‘zii.widgets.grid.CGridView’, array(

								'id' =&gt; 'my-grid',









					'header' =&gt; '',

					'class' =&gt; 'CButtonColumn',




    'status' =&gt; array




                                &#036;.fn.yiiGridView.update('my-grid', {



                                    success:function(data) {

                                          &#036;('#AjFlash').html(data).fadeIn().animate({opacity: 1.0}, 3000).fadeOut('slow');




                                return false;




    )) ,



)); ?>

<div id=‘AjFlash’ class=“flash-success” style=“display:none”>Hello</div>

On clicking the button, the database get’s mofified and my grid gets updated with the value but the flash message is not displayed

here is my controller

public function actionStatus($id)














If I do not check for isset($_GET[‘ajax’]), I’m not returned back to my view which means that this request is not ajax right? and if it is why is my flash message not displaying?

Any help would be appreciated…



If you want to display a message from your controller you should echo it from your action.

Yes I have tried that as well … even if I’m not echoing anything. shouldn’t it just display the ajflash div …