Objective: make the button "Add to favorites" and the page with the map of selected goods. My favorites post id stored in js-cookie array
liked = $.cookie("liked");
$.ajax({
type: "GET",
url: ajaxurl,
data: {
action : 'ids',
id : liked
},
success: function (response) {
console.log('AJAX response : ',response);
}
in functions.php
add_action( 'wp_ajax_ids', 'ids_function' );
add_action( 'wp_ajax_nopriv_ids', 'ids_function' );
function ids_function()
{
$myArray = array($_REQUEST['id']);
wp_send_json( $myArray );
}
in the page with the map of selected goods i call finction ids_function()
and page return null
. But in console.log i see the need array. How to get it in my page?? TNX!