So i write the code
in <body onUnload="bye()"></body>
In javascript
-------------
Expand|Select|Wrap|Line Numbers
- <script type="text/javascript">
- function bye(){
- alert("Before Ajax..!");
- $.ajax({
- type : 'GET',
- url : "/patient/myMealPlan",
- });
- alert("onUnLoad Bye");
- }
- </script>
In spring MVC Controller class
--------------------------------
Expand|Select|Wrap|Line Numbers
- @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?