show flash message using ajax

Hi guys. The problem is: At Cgridview onclick event, i call my action using ajax:

$.ajax({

type: "GET",


url: "index.php?r=protocolo/message",


dataType : "html",


 });

ProtocoloController/message:

if(Yii::app()->request->getIsAjaxRequest())

{

Yii::app()->user->setFlash(‘success’, “Data1 saved!”);

			$this->renderPartial('flash');

}

View flash:

<?php if(Yii::app()->user->hasFlash(‘success’)):?>

&lt;div class=&quot;info&quot;&gt;


    &lt;?php echo Yii::app()-&gt;user-&gt;getFlash('success'); ?&gt;


&lt;/div&gt;

<?php endif; ?>

But the result on firebug console is a plan text "Data1 saved".

What i need to do or what i do wrong to display flash messages using ajax.

Thanks!

where do you expect this message to appear? it looks like there is no target!

look for the success function http://api.jquery.com/jQuery.ajax/

Take a look at the extension userflash it will do all the work for you.

If you don’t want to use this extension you can take a look at the code of the ‘EUserFlash::setAjaxMessage’ to see how it works.

Thank you so much!