Wordpress AJAX How to Implement Server Side Response
0
I'm attempting to implement an AJAX request and response all within one wordpress page. My request is getting a response containing the page's html contents, and not the data that my response function is supposed to output. Do I need to enqueue the response script from a separate file? b.on("click", function(){ var data = data = retrieve_hst() console.log(data) jQuery.ajax({ type: "POST", url: "./wp-admin/admin-ajax.php", data: { action: "recordData", hst_data: data } }).done(function(response) { alert (response); }); <?php add_action('wp_ajax_recordData', 'recordData' ); add_action('wp_ajax_nopriv_wps_recordData', 'recordData' ); function recordData() { $data = $_POST['hst_data']; e