[Solved] Save advert click to database using PHP, then open link
You will want to do something like $(function() { $(“.advertLink”).on(“click”,function(e) { e.preventDefault(); // stop the link unless it has a target _blank or similar var href = this.href; var id=this.id; // or $(this).data(“advertid”) if you have data-advertid=”advert1″ on the link $.post(“./wp-content/plugins/facilitaire-advert-widget/save-advert-click.php”, { “action”:”call_this”, “advert_ID”:id }, function() { location=href; // or window.open } ); }); }); … Read more