I would like to call spring mvc method when ever onUnload.
So i write the code
in <body onUnload="bye() "></body>
In javascript
-------------
In spring MVC Controller class
--------------------------------
In java-script alert()'s are calling properly but coming to spring MVC controller will not call.
Why it is not called ?
Is there any .js file we need to import in .jsp file ?
if so which file .js file i would like to import?
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",
});
alert("onUnLoad Bye");
}
</script>
In spring MVC Controller class
--------------------------------
Code:
@RequestMapping(value="myMealPlan", method=RequestMethod.GET)
public String init(ModelMap map, HttpServletRequest request){
System.out.println("Bye method called..!");
Why it is not called ?
Is there any .js file we need to import in .jsp file ?
if so which file .js file i would like to import?
Comment