Handling Ajax Session Timeout Using $Loginrequiredajaxresponse In Yii

I am struggling to find a way for handling ajax session timeout so that user directs to login page and after login, user should be redirected to same page, where user was. As per the yii documentation, we can achieve it using $loginRequiredAjaxResponse property. I am not sure how we can implement it practically. I tried assigning this property the url where user should be redirected after login, but did not work. For non ajax request, there is straight forward method loginRequired() to achive it.

Please read carefully the documentation for this property…

Ajax calls are made from JS not from PHP so you cannot just return an URL and expect the page to be redirected there… [size=2]you set this property to some value like a string "session expired" or a json string (depends on expected return value from your ajax call)… then from your JS code you need to check for that value and act accordingly. [/size]

[color="#006400"]NOTE: moved to proper section (General Discussion for Yii 1.1.x instead of Feature Request)[/color]

There is a wiki with an example on how to use this property - http://www.yiiframework.com/wiki/321/using-loginrequiredajaxresponse-to-solve-ajax-session-timeout/

Thanks for the response Maurizio. If it is not possible to take back user to the page, then it is not of my use at all. Thanks for the reply again, otherwise I would have wasted a lot of time.