Javascript plug in Noty gives error

Viewed 6203

I have the following javascript code:

function delete_draft(id, name) {
    var text = 'Are you sure you want to delete "' + name + '"?';
    alert(id + name)
    var noty = noty({
        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();
        }
        }
    ]});
}

When I run from the consul delete_draft(6, "this is it") I get this error

TypeError: undefined is not a function
arguments: Array[1]
get message: function () { [native code] }
get stack: function () { [native code] }
set message: function () { [native code] }
set stack: function () { [native code] }
type: "called_non_callable"
__proto__: Error

How can I fix this? The website for Noty is http://needim.github.com/noty/ If you think it should work, comment.

2 Answers
Related