Jquery Mobile & Yii

Hello Guys,

I’m working for a project using JQueryMobile & Yii without using Yii’s Ajax functions, now having problem with authentication. And I’m not sure Yii query works all fine with JQueryMobile or not.

My Issue:

When I access a authentication required page, it can’t redirect to login page automatically. If I disable JQueryMobile’s ajax functions, it works just fine.[something like ajaxEnabled = false]

After some searching, I found I need to set ‘loginRequiredAjaxResponse’ in order to enable the redirection,


public function loginRequired()











				$route=isset($url[0]) ? $url[0] : $app->defaultController;








		echo $this->loginRequiredAjaxResponse;



	throw new CHttpException(403,Yii::t('yii','Login Required'));


It seems Yii just end current Session, so it will redirect to Login page, unfortunately, it not works for me.

my config/main.php



		// enable cookie-based authentication



		'loginRequiredAjaxResponse' => 'YII_LOGIN_REQUIRED',

		'class' => 'CWebUser',


Although I can work around this issue by enforcing to redirect to login page, like commenting out $request->getIsAjaxRequest() checking, but I can’t understand it why Yii’s function not work for me. It’s better to leverage Yii’s function I believe, but somehow it just can’t redirect automatically. Need your help, thanks.