Maybe I am missing something simple here, but it is frustrating me. So what I need to do is update something on my server when this div around a link is clicked (I am doing click thru analytics). I figured I would do a click event and do an ajax call (via get).
$.get("stat/418491289);
But the problem is, the call isn’t being made. The user is being sent to the next page and not calling get call isn’t being completed/called. I would know because on the server it would update the database. Maybe I shouldn’t be making an ajax call, or maybe there is something I should be doing, but I am not sure. I cannot suspend the link action for now because it is wrapped in the div. What I would like to do ideally is fire off the request and then not worry about it. Updating the stat is not critical, so if it doesn’t work 1% of the time, that is more than ok. How would I do this?
I guess I might not be being clear. What I am asking is: Can I fire off a request to my server via javascript before the browser goes to the linked page? I don’t care what the response is, I just need to send the request.
if i have understood the question clearly you need to use
preventDefaultinorder to cancel the default behavior of the link likeor put a
return false;