35 lines
1.4 KiB
JavaScript
35 lines
1.4 KiB
JavaScript
jQuery(document).ready(function ($) {
|
|
// console.log("Loaded check-domain-health.js");
|
|
$('#check-domain-health-button').on('click', function (e) {
|
|
e.preventDefault();
|
|
|
|
//var postId = $('#post_ID').val(); // Get the current post ID
|
|
var postData = {
|
|
action: 'rl_mailwarmer_check_domain_health',
|
|
post_id: rlMailWarmer_public.post_id,
|
|
security: rlMailWarmer_public.nonce,
|
|
};
|
|
// console.log("AJAX URL: " + rlMailWarmer_public.ajax_url);
|
|
// console.log("Post Action: " + postData.action);
|
|
// console.log("Post postId: " + postData.post_id);
|
|
// console.log("Post security: " + postData.security);
|
|
|
|
$('#domain-health-result').html('<p>Checking domain health...</p>');
|
|
|
|
$.ajax({
|
|
url: rlMailWarmer_public.ajax_url,
|
|
type: 'POST',
|
|
data: postData,
|
|
success: function (response) {
|
|
if (response.success) {
|
|
$('#domain-health-result').html('<p>Report saved successfully. Post ID: ' + response.data + '</p>');
|
|
} else {
|
|
$('#domain-health-result').html('<p>Error: ' + response.data + '</p>');
|
|
}
|
|
},
|
|
error: function (xhr, status, error) {
|
|
$('#domain-health-result').html('<p>AJAX Error: ' + error + '</p>');
|
|
},
|
|
});
|
|
});
|
|
});
|