I have this:
PHP:
add_action('wp_ajax_count_messages', 'count_messages');
function count_messages($projectid) {
//some code
wp_send_json_success($projectid);
}
JS:
var countData = {
'action': 'count_messages',
'projectid': '100'
}
var myRequest =
$.ajax({
url: admin_ajax.ajax_url,
type: 'post',
data: countData
});
myRequest.done(function(data){ console.log(data); });
When I check console, I get:
{success: true, data: ""}
I am not sure what is happening and why I get an empty string?