<p>I'm using <code>$.post()</code> to call a servlet using Ajax and then using the resulting HTML fragment to replace a <code>div</code> element in the user's current page. However, if the session times out, the server sends a redirect directive to send the user to the login page. In this case, jQuery is replacing the <code>div</code> element with the contents of the login page, forcing the user's eyes to witness a rare scene indeed. </p>

<p>How can I manage a redirect directive from an Ajax call with jQuery 1.2.6?</p>

Use the low-level
```
$.ajax()
```
call:
```
```
$.ajax({
  url: "/yourservlet",
  data: { },
  complete: function(xmlHttp) {
    // xmlHttp is a XMLHttpRquest object
    alert(xmlHttp.status);
  }
});
```
```
Try this for a redirect:
```
```
if (xmlHttp.code != 200) {
  top.location.href = '/some/other/page';
}
```
```