How to do Ajax in WordPress

updated 10th Jan 2018 Write a javascript function to trigger the ajax call jQuery(‘#button_or_something’).on(“click”, function() { jQuery.ajax({ url: ajax_object.ajax_url, data: { action: ‘like_or_not’, /* this is appended to add_action on server side */ id: ’99’ }, type: ‘GET’, success:function(response){ //alert(‘back from ajaxe ‘+response); /* if you want to update something based on the response text … Read more