So i write the code
in <body onUnload="bye() "></body>
In javascript
-------------
Code:
<script type="text/javascript">
function bye(){
alert("Before Ajax..!");
$.ajax({
type : 'GET',
url : "/patient/myMealPlan",