Creating Nice Alerts with sweetAlert

Hello,
thank you, very good script.
You also need to add functions php on the server without opening a new window.
For example:

swal({
            title: 'Are you sure?',
            text: 'You will not be able to recover this imaginary file!',
            type: 'warning',
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            confirmButtonText: 'Yes, delete it!',
            cancelButtonText: 'No, cancel plx!',
            closeOnConfirm: false,
            closeOnCancel: false
        },
        function(isConfirm) {
            if (isConfirm) {
              swal(
                'Deleted!',
                'Your file has been deleted.',
                'success'
              );
                window.location = 'delete_files_server.php'; 
            } else {
              swal(
                'Cancelled',
                'Your imaginary file is safe :)',
                'error'
              );
            }
        });