I am trying to send some requests to the database when the window is unloaded (i.e. when you refresh the page). For some reason, only on Safari, the client side code gets executed, but the request to the server never goes through. When I step through the code manually in the debugger, the server does get the request and processes it fine.
Anyone know why this is happening?
window.onbeforeunload = function() {
console.log("inside on before unload");
var requestParam = new a.ListRequest();
requestParam.setAction('set_delete');
var callback = function(isSuccess, response) {
if (isSuccess) {
//do something
} else {
// do something else
}
};
// Sends request to server
a.Fetch.list(requestParam, callback);
}