1$(document).ready(function() {
2 var start = new Date();
3
4 $(window).unload(function() {
5 var end = new Date();
6 $.ajax({
7 url: "log.php",
8 data: {'timeSpent': end - start},
9 async: false
10 })
11 });
12});
13