On one of my pages I have a div that uses ajax to load content asyncrohnously. When a session expires the user is supposed to be redirected back to the loggin screen. However, when the session expires and the ajax call is triggered the login page gets put inside the div. What I want is for the user to be redirected back to the login screen.
+1
A:
Perhaps you can inspect the content you get back from the AJAX call to see if there is anything that defines it to be the login page (maybe a unique element with an id)? If that is the case, you can perform a redirect.
Something like:
jQuery.ajax({
...
success: function(html) {
var element = jQuery(html).find("div#loginDiv");
if(element.length == 0) {
//perform redirect
}
else {
//insert content
}
},
...
});
Vivin Paliath
2010-06-23 18:08:04