I have 2 links on my page
link1 - displays an video player overlay when clicked but for SEO support Search engines would follow the link to a video detail page (video1.htm).
<a href="video1.htm" onclick="watchVideo(1);return false;">watch video</a>
link 2 - redirects the browser to the home page
<a href="home.htm">return home</a>
I'm attaching a click event for tracking to every link
$(document).on("click", "a", track);
in the track() function I'm making an asynchronous request to an image for tracking
I want to wait for the tracking request to finish before following the link.
I do not want to follow the link for the video player since the watchVideo() function opens a layover to show the video.
how can I wait for the tracking to finish before allowing the link to navigate or play the overlay.
I've seen code that does an event.preventDefault() then do a window.location=link.href. this does not work in the case of the video overlay since I don't want to navigate to the link.