jQuery(document).ready(function ($) { $('#update-dmarc-record-button').on('click', function (e) { e.preventDefault(); const postId = rlMailWarmerDmarc.post_id; const data = { action: 'rl_mailwarmer_update_dmarc_record', post_id: postId, security: rlMailWarmerDmarc.nonce, policy: $('#dmarc_policy').val(), sp: $('#dmarc_sp').val(), pct: $('#dmarc_pct').val(), aspf: $('#dmarc_aspf').val(), adkim: $('#dmarc_adkim').val(), rua: $('#dmarc_rua').val(), ruf: $('#dmarc_ruf').val(), fo: $('#dmarc_fo').val(), rf: $('#dmarc_rf').val(), ri: $('#dmarc_ri').val(), }; $('#dmarc-update-result').html('

Updating DMARC record...

'); $.ajax({ url: rlMailWarmerDmarc.ajax_url, method: 'POST', data: data, success: function (response) { if (response.success) { $('#dmarc-update-result').html('

' + response.data + '

'); } else { $('#dmarc-update-result').html('

Error: ' + response.data + '

'); } }, error: function (xhr, status, error) { $('#dmarc-update-result').html('

AJAX Error: ' + error + '

'); }, }); }); });