i have made a function destroy() that is being called onclick event of logout button. But the problem is server side code in that function being always called on page load whether the logout button being clicked or not. All i want to do is to set a value for session varaible lastVisit onclick event of logout button. Kindly let me know what is an appropriate way to do it thanks,
              function destroy()
                {
                <?php $_SESSION['lastVisit'] = "logout"; ?>
                alert('hi');
                }
 
     
    