I want to call a server side API but the problem is even before API call is made browser gets closed.
$(window).on('beforeunload ', function() {
var date = Date.now();
var params = {
"accountid": localStorageService.get('accountid'),
"refreshtoken": localStorageService.get('refreshtoken'),
"date": date
};
accountSvc.browserClose(params).$promise
.then(function(response) {
}).catch(function(er) {
console.log(er);
});
});