38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
jQuery(document).ready(function ($) {
|
|
$('#update-mx-record-button').on('click', function (e) {
|
|
e.preventDefault();
|
|
|
|
// const postId = $('#post_ID').val();
|
|
const postId = rlMailWarmerMx.post_id;
|
|
const action = $('#mx_action').val();
|
|
const content = $('#mx_content').val();
|
|
const priority = $('#mx_priority').val();
|
|
const ttl = $('#mx_ttl').val();
|
|
|
|
$('#mx-update-result').html('<p>Updating MX record...</p>');
|
|
|
|
$.ajax({
|
|
url: rlMailWarmerMx.ajax_url,
|
|
method: 'POST',
|
|
data: {
|
|
action: 'rl_mailwarmer_update_mx_record',
|
|
post_id: postId,
|
|
action_type: action,
|
|
content: content,
|
|
priority: priority,
|
|
ttl: ttl,
|
|
security: rlMailWarmerMx.nonce,
|
|
},
|
|
success: function (response) {
|
|
if (response.success) {
|
|
$('#mx-update-result').html('<p>' + response.data + '</p>');
|
|
} else {
|
|
$('#mx-update-result').html('<p>Error: ' + response.data + '</p>');
|
|
}
|
|
},
|
|
error: function (xhr, status, error) {
|
|
$('#mx-update-result').html('<p>AJAX Error: ' + error + '</p>');
|
|
},
|
|
});
|
|
});
|
|
});
|