Social Icons

Pages

Saturday, March 30, 2013

Display a nice exception message on ajax requests


please refer the link


 http://www.yiiframework.com/wiki/228/display-a-nice-exception-message-on-ajax-requests/


or use the below code in your default controller


public function actionError()
{
    if($error=Yii::app()->errorHandler->error)
    {
        if(Yii::app()->request->isAjaxRequest)
            echo $error['message'];
        else
            $this->render('error', $error);
    }
}


No comments:

Post a Comment