Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • I was trying to avoid the low level stuff. Anyway, suppose I use something like what you describe, how do I force a browser redirection once I detect that the HTTP code is 3xx? My goal is to redirect the user, not just to announce that his/her session has expired. Commented Oct 14, 2008 at 13:25
  • 4
    Btw, $.ajax() is not very, very low-level. It's just low-level in terms of jQuery because there is $.get, $.post, etc. which are much more simple than $.ajax and all its options. Commented Oct 14, 2008 at 13:31
  • 17
    Oh boy! Sorry I had to "un-accept" your answer, it still very helpful. Thing is, redirections are automatically managed by the XMLHttpRequest, hence I ALWAYS get a 200 status code after the redirection (sigh!). I think I will have to do something nasty like parsing the HTML and look for a marker. Commented Oct 14, 2008 at 15:19
  • 1
    Just curious, if the session ends at the server, doesn't that mean the server sends a different SESSIONID? couldn't we just detect that? Commented Dec 16, 2008 at 1:35
  • 10
    NOTE: This does not work for redirects. ajax will go to the new page and return its status code. Commented Mar 14, 2010 at 4:34