Just want to ask if is it possible to clear a PHP session using a jquery or javascript process? Because what I want to do is to clear the PHP session using a dialog box. If
You can't clear a php session using Javascript directly.
PHP is a server-side language, whereas Javascript is client-side..
However, you can throw an ajax request to the specified page that handles the destruction.
Like this:
// Client-side
$.post("logout.php", {"can_logout" : true}, function(data){
if(data.can_logout)
// redirect the user somewhere
}, "json");
true));
?>
Or just point the user to some page that handles the session destruction; i.e. logout.php