34k+
News
Guide
API
Wiki
Forum
Community
Places
Members
Hall of Fame
Badges
More
Learn
Books
Resources
Develop
Download Yii
Extensions
Report an Issue
Report a Security Issue
Contribute to Yii
Donate
About
Release Cycle
License
Team
Official Logos and Design
Login
Using loginRequiredAjaxResponse to solve ajax session timeout
Comparing
#2
with
#3
Revision #3 was created by
Rutger
on Jan 4, 2017, 5:46:56 PM.
Fixed jQuery(document).ajaxComplete, thx to @myvay
« Previous (#2)
Content
[...]
```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;
}
}
[...]