0

I'm writing this js function to get executed when the page is being closed. Basically to send the logout time of a person to the server. But for some reason, I get nothing written on the server. My current code looks like this:

window.onbeforeunload = closingCode;
function closingCode(){
    var logout=getCookie("current-time");
    $.ajax({ url: './scripts/Functions.php',
 data: {function2call: 'sendLogout', arguments: [person_ID,"Logout","Logout",logout]},
         type: 'post',
         success: function(output) {
                 console.log("Sent Analytics Value (Logout)");
         }
});
return false;
}
Shri
  • 709
  • 1
  • 7
  • 23

0 Answers0