jquery-slidePanel
jquery-slidePanel copied to clipboard
Ajax response
When I load the content of a slidePanel using an ajax call I want to check whether the response I got was valid or not. The api does not allow me to do that. Since the afterLoad method does not expose the response object.
My scenario is: I have an logged in user that has expired or logged out in a different tab. When this user opens a slidePanel it renders the login page within the slidepanel. I want to be able to get the response, which has a special header telling me that the user has been redirected, and change the window.location to the redirect page.
EDIT I made a temporary solution that on afterLoad I check the content that has being loaded to the slidePanel div
var $panel = $('.slidePanel-content');
if ($panel.html().indexOf("script") > -1 && $panel.html().indexOf("meta") > -1) {
$('.slidePanel').hide();
window.location.replace('/login');
}
But it still open up the slide panel before redirecting to login page. Is there a way to stop the opening of a slidepanel from happening?