I'm a relative newbie to web development:
When the PHP session expires, my navigation bar, which is based on JQuery.load stops functioning, as I guess it can no longer load the requested page. The UX is "freeze". How do I detect such a load failure and re-direct folks back to the login screen (after perhaps alerting them the session expired)?
Here's the code I use:
function loadPage(page)
{
switch (page)
{
case 1: // dashboard
this.pageToLoad = 'pages/page1.php';
break;
case 16: // another page
this.pageToLoad = 'pages/page2.php';
break;
default: // unimplemented for all the rest
this.pageToLoad = 'pages/unimplemented.php';
break;
}
$('.myNav').load(this.pageToLoad);
}