I would like to destroy $_SESSION[‘userList’] after cliking ‘Cancel’ button. However, the $_SESSION[‘userList’] is destroied when page load.
Below is my code:
<a href='#' class="btn" onClick="resetForm()"><span>Cancel</span></a>
<script type="text/javascript">
function resetForm() {
<?php
unset($_SESSION['userList']);
?>
}
</script>
Really appreciate for any help.
JAVASCRIPT
PHP