JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://ruseller.com/adds/adds2561/example/js/jquery.noty.js"></script>

JavaScript

function delete_draft(id, name) {
    var text = 'Are you sure you want to delete "' + name + '"?';
    alert(id + name)
    var note = $.note({
        text: text,
        buttons: [
        {addClass: 'btn btn-primary', text: 'Yes', onClick: function($noty) {

            // this = button element
            // $noty = $noty element

            $noty.close();
            $.post('/ajax/drafts/delete', {id:id}, function(data) {
                document.location.reload(true);
            });
        }
        },
        {addClass: 'btn btn-danger', text: 'Cancel', onClick: function($noty) {
            $noty.close();
        }
        }
    ]});
}

    
    $(document).ready(function(){delete_draft(6, "this is it");});