Hello!
You must pass two variables without reloading the page when clicking on an item. At the moment, the code looks like this:
var id = "<?php echo $row["id"];?>"; var count_vk = "1"; var count_fb = "1"; var count_tw = "1"; $(document).ready( function() { $("#share_wrap_vk").click(function(){ $.ajax({ type: 'POST', url: '/blocks/share_counter.php', data: "" }); }); $("#share_wrap_fb").click(function(){ $.ajax({ type: 'POST', url: '/blocks/share_counter.php', data: "" }); }); $("#share_wrap_tw").click(function(){ $.ajax({ type: 'POST', url: '/blocks/share_counter.php', data: "" }); }); }); You need to transfer the id and count_vk to the share_counter.php document. count_vk, fb, tw are needed only to understand which field to update in the database table. I get the id when loading the page from the database. The essence of the script is to count the number of clicks on a link with a specific identifier.