Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Session timeout response in AJAX

In my application, I'm loading some table using AJAX. But when user's session times out it gives me login page as response that gets loaded in table area.

I would like to redirect to login page may be in javascript when session timeout occurs during AJAX call.

like image 839
Chinmayee G Avatar asked Oct 14 '10 06:10

Chinmayee G


1 Answers

When rendering the login page you could append a custom HTTP header to the response: X-LOGIN-PAGE: True. Then perform your AJAX call and check for the presence of this custom header in the success callback. Act accordingly if present.

like image 88
Darin Dimitrov Avatar answered Oct 05 '22 11:10

Darin Dimitrov