40 lines
1.4 KiB
JavaScript
40 lines
1.4 KiB
JavaScript
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('<p>Updating DMARC record...</p>');
|
|
|
|
$.ajax({
|
|
url: rlMailWarmerDmarc.ajax_url,
|
|
method: 'POST',
|
|
data: data,
|
|
success: function (response) {
|
|
if (response.success) {
|
|
$('#dmarc-update-result').html('<p>' + response.data + '</p>');
|
|
} else {
|
|
$('#dmarc-update-result').html('<p>Error: ' + response.data + '</p>');
|
|
}
|
|
},
|
|
error: function (xhr, status, error) {
|
|
$('#dmarc-update-result').html('<p>AJAX Error: ' + error + '</p>');
|
|
},
|
|
});
|
|
});
|
|
});
|