• CONTEST ALERT - Experience the power of DDR5 memory with Kingston Click for details

logout confimation with jquery alert?

bagsfr

Right off the assembly line
hey all,
i wanna make a confirmation alert box (jquery i suppose) then when triggers when someone click log out. on cancel it stays there but on ok it destory the session and cookies and logout. anyone help me out me wid that?
 

krishnandu.sarkar

Simply a DIGITian
Staff member
No need of jQuery, simple javascript would do this.

Code:
var logout = confirm("Do you really want to Logout?");
if (logout == true)
{
   window.location="http://yourplace.com/yourpage.php";
}

Now put this under a function say confirmLogout() and call this on onclick event of button.

Now on that PHP page, where you'd redirect destroy the session etc. and whatever you want to do and redirect it to homepage at last.

For eg.
PHP:
<?php

ob_start();
session_start();
session_destroy();

header("Location:homepage.html");

?>
 
Top Bottom