javascript variable to wordpress php variable
First you need to to send function name as additional data as $.ajax({ type: “POST”, url: compareids_ajax.ajax_url, data: { // Data object compareIDs : compareIDs, action: ‘your_ajax_function’ // This is required to let WordPress know which function to invoke }, contentType: “application/json; charset=utf-8”, dataType: “json”, success: function (msg) { console.log( msg ); }, error: function … Read more