1jQuery(document).ready(function() { 2 jQuery('.tagbutton').click(function() { 3 var tag = jQuery(this).data('tag'); 4 var id = JSINFO.id; // Current page ID 5 6 jQuery.ajax({ 7 url: DOKU_BASE + 'lib/exe/ajax.php', 8 type: 'POST', 9 data: { 10 call: 'tagbutton_add', 11 tag: tag, 12 id: id 13 }, 14 success: function(response) { 15 var result = JSON.parse(response); 16 if (result.status === 'success') { 17 // Refresh the page if the tag is successfully added 18 location.reload(); 19 } 20 } 21 }); 22 }); 23}); 24