HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1014-azure #14~24.04.1-Ubuntu SMP Fri Oct 3 20:52:11 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/truelysell-wp-demo/catering/wp-content/themes/truelysell/assets/js/staff-remove.js

jQuery(document).ready(function ($) {
    $('.delete-staff-btn').on('click', function () {
        var userId = $(this).data('user-id'); // Replace with your logic to get the user ID
  
        $.ajax({
            type: 'POST',
            url: ajax_object.ajax_url,
            data: {
                action: 'delete_controlled_user',
                user_id: userId,
                security: ajax_object.nonce
            },
            success: function (response) {
                if (response.success) {
                    alert(response.data.message);
                    location.reload(); // Reload the page or update the UI as needed
                } else {
                    alert(response.data.message);
                }
            },
            error: function () {
                alert('An error occurred while trying to delete the user.');
            }
        });
    });
  });


    document.getElementById('usernameInput').addEventListener('input', function () {
    this.value = this.value.replace(/\s/g, '');
  });