I have got this html:
<a href="http://www.google.com" data-ref="su1c2cess" class="Wifewriting" id="target_site_to_visit">
<span data-app-id="63" class="btn" id="visit_site" style="right:22px; top:65px; padding:5px;z-index: -99999;">VISIT SITE</span>
</a>
UPDATE And this is my jQuery:
$(document).ready(function(){
$('body').on('click','#target_site_to_visit',function(event){
var appName=$('#target_site_to_visit').attr('class');
var referrer=$('#target_site_to_visit').attr('data-ref');
$.post('db/update_site_viewed.php',{ name:appName, ref:referrer }, function(data){
throw new Error("AppName: "+appName);
},'html').error(function(data){
throw new Error("Error: "+data.responseText);
});
// document.location.href=$('#target_site_to_visit').attr('href');
return false;
});
});
The event.preventDefault();
does nothing in stopping the link from being triggered.. why?