Changes
Title
unchanged
Using loginRequiredAjaxResponse to solve ajax session timeout
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
loginRequiredAjaxResponse, session, login, AJAX
Content
changed
[...]
```php
<?php
if (Yii::app()->components['user']->loginRequiredAjaxResponse){
Yii::app()->clientScript->registerScript('ajaxLoginRequired', '
jQuery("body"document).ajaxComplete(
function(event, request, options) {
if (request.responseText == "'.Yii::app()->components['user']->loginRequiredAjaxResponse.'") {
window.location.href = options.url;
}
}[...]