')); jQuery.ajax({ type: 'POST', dataType: 'json', url: '/wp-admin/admin-ajax.php', data: { 'action' : 'bpc_declare_called_eliminated', //calls wp_ajax_nopriv_declare_called_eliminated 'cid' : cid, 'raceID' : raceID, 'state' : state, 'status' : status }, success: function(data){ if (data.data.state == 'true'){ if (data.data.status == 'winner'){ jQuery('.alert-success').html('Race has been successfully called'); } else { jQuery('.alert-success').html('Candidate has been successfully eliminated.'); } } else { if (data.data.status == 'winner'){ jQuery('.alert-success').html('Race has been successfully uncalled'); } else { jQuery('.alert-success').html('Candidate has been successfully uneliminated.'); } } jQuery('.alert-success').show(); jQuery('.alert-success').delay(0000).fadeOut(); }, error: function(data){ console.log("ajax error"); }, }); }, 