I am using the Wordpress heartbeat and am attempting to pass some data to my site using Ajax. I am able to see the action in my $_POST but my data is not available. The below .post is able to send a request to MyZabbix, that post contains my action, my action then works. However, I need access to the indexs['hosted']. Why would the below .post not send my data when sending the action?
$( document ).on( 'heartbeat-tick', function( e, data ) {
$.each( data, function( index, value ) {
$.each( value, function( indexs, values ) {
var hostids = indexs['hostid'];
$.post( MyZabbix.ajaxurl, {
action:'zabbix_ajax_submit',
data: indexs['hostid'] },
function( api_response ) {
console.log( "Data Saved: " + api_response );
});
}(jQuery));