38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
jQuery(document).ready(function ($) {
|
|
$('#update-spf-record-button').on('click', function (e) {
|
|
e.preventDefault();
|
|
|
|
// const postId = $('#post_ID').val();
|
|
const postId = rlMailWarmerSpf.post_id;
|
|
const host = $('#spf_host').val();
|
|
const action = $('#spf_action').val();
|
|
const allPolicy = $('#spf_all_policy').val();
|
|
const ttl = $('#spf_ttl').val();
|
|
|
|
$('#spf-update-result').html('<p>Updating SPF record...</p>');
|
|
|
|
$.ajax({
|
|
url: rlMailWarmerSpf.ajax_url,
|
|
method: 'POST',
|
|
data: {
|
|
action: 'rl_mailwarmer_update_spf_record',
|
|
post_id: postId,
|
|
host: host,
|
|
action_type: action,
|
|
all_policy: allPolicy,
|
|
ttl: ttl,
|
|
security: rlMailWarmerSpf.nonce,
|
|
},
|
|
success: function (response) {
|
|
if (response.success) {
|
|
$('#spf-update-result').html('<p>' + response.data + '</p>');
|
|
} else {
|
|
$('#spf-update-result').html('<p>Error: ' + response.data + '</p>');
|
|
}
|
|
},
|
|
error: function (xhr, status, error) {
|
|
$('#spf-update-result').html('<p>AJAX Error: ' + error + '</p>');
|
|
},
|
|
});
|
|
});
|
|
});
|