[jQuery] Detecting a redirect response to an Ajax query
Is there any way to be able to detect in $.ajax whether the response
involved a HTTP redirect?
My backend application times out sessions, and if the next request
comes in after the session has timed out, it redirects the user to /
signup/login. Unfortunately, if this happens when the client issues an
ajax request, the login page gets inserted into the middle of my
existing page.
I googled around for this, and I found the suggestion that I should
just check for the text of my login page and abort if it's seen. This
will obviously work, but is a bit messy, and I have to wrap $.ajax to
avoid duplicating this logic all over my javascript. I just wondered
if there's a cleaner way of doing this?
Many thanks,
Brian.