I searched a lot and all I found out was that AJAX is used to execute a php code in another file. I want to know if it is possible and if yes then how do I execute a php code that is written in the same file.
Here is my jQuery code...
$(document).ready(function(){
$("#logout").click(function(){
//execute the php code here.
});
});
And here is the php code i want to execute
<?php
session_unset();
session_destroy();
?>
Basically, to give an overview of what I am trying to achieve, I am using a button with id="logout" to stop the session and logout of the webpage.
issetstatement on that button when you render the page?