In my CodeIgniter controller every Ajax request checks the token I Passed. If any thing happens wrong I wrote a controller function to destroy all session and logout
'redirect('main/logincontent/load_logout');'
In load_logout function
function load_logout() {
echo "<script>var c=confirm('do you want to continue?');
if(c==true)
{
}
else
{</script>";
$this -> session -> sess_destroy();
echo "<script>window.parent.location.href ='" . base_url() . "';
}</script>";
}
I tried put a confirm box at the beginning of the function load_logout(). Based on confirm box result user can decide whether to destroy session and logout or stay Online.
But it is not working!!!
Any help would be appreciated.