I'm using django and jquery to implement authenticated sessions and Ajax requests.
I have authenticated session timeouts to log authenticated users out after a long period of inactivity on my site. Some of the pages on my site have a lot of AJAX calls in them that require the user to be in an authenticated session. When a user leaves such a page open for a long time and has the session auto-timed out, any AJAX calls made will just fail and show a browser error. My web stack (django) returns a redirect to login for these AJAX requests, but they just show up as errors to $.ajax() (using jquery.)
How could I reload the page and send the user to the login page through an AJAX request when I find that their auth session has timed out?