jQuery(document).ready(function ($) { $('#test-ssh-connection-button').on('click', function (e) { e.preventDefault(); const postId = rlMailWarmerTestSSH.post_id; $('#test-ssh-connection-result').html('

Testing connection...

'); $.ajax({ url: rlMailWarmerTestSSH.ajax_url, method: 'POST', data: { action: 'rl_mailwarmer_test_ssh_connection', post_id: postId, security: rlMailWarmerTestSSH.nonce, }, success: function (response) { if (response.success) { $('#test-ssh-connection-result').html('

Success: ' + response.data + '

'); } else { $('#test-ssh-connection-result').html('

Error: ' + response.data + '

'); } }, error: function (xhr, status, error) { $('#test-ssh-connection-result').html('

AJAX Error: ' + error + '

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