I have links in a notifications menu (kind of like on facebook, or here on SO) and when the notification is clicked I want to make an AJAX call to mark the notification as 'read' and then follow the link.
My question is, if I make a click
handler such as this:
$(".elements").on("click", function() {
// make AJAX request
return true;
});
Can I be assured the click handler will be fully executed (and the AJAX request made to the server) before the browser follows the link?
I think the answer is yes, since adding this attribute to links:
onclick="return false;"
Prevents the link from being followed, but I've been searching and haven't been able to find a concrete answer to my question, and I want to be 100% sure.