You can deal with the situation in multiple ways without preventing the default.
First:
You can have a link without any href and do the redirect on the click callback
<a href='#'>I'm a link!</a>
$('a').on('click', function() {
  // store what link was clicked in database
  $.post('/save', {}).done(function(){
    window.location.href = 'http://stackoverflow.com';
  });
}));
Second:
There is a special api that handles the ajax request reliable on the page unload phase : navigator.sendBeacon https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon that improves performance since is non blocking.
var payload;
$('a').on('click', function(e) {
  // Cache what link was clicked
  payload = null; // get info from the event e
}));
document.addEventListener('visibilitychange', function() {
  if (document.visibilityState === 'hidden') {
    navigator.sendBeacon('/save', payload);
  }
});