Say I have a URL:
<a href="hello.html" id="4298">hello</a>
When someone clicks this link, I want it to fire a script off using ajax so we can track how many times this link has been clicked behind the scene.
My page is called track.php which will pull the ID 4298 via GET, track.php?id=4298 and then it updates the database respectively.
How would I go about coding this in javascript/ajax so upon this link being clicked, in form of an "onclick event", this track.php will be ran behind the scene?
Keep in mind that to do a request in the background, you will need to wait for the AJAX response to follow the click. If that’s what you want, then using jQuery: