Javascript examples for jQuery Method and Property:ajax
Send a ajax when leave button is clicked onbeforeunload jquery
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> <script type="text/javascript"> window.onbeforeunload = callajax;// w w w. j ava 2 s . c om function callajax() { /*Your ajax call code*/ return "ajax response";//returning ajax response } </script> </head> <body> <a href="http://Yahoo.com">Yahoo</a> </body> </html>