0

我正在使用一个名为 Noty( http://needim.github.com/noty/ ) 的对话插件。我用它来创建一个确认对话框。这是我的代码:

function delete_draft(id, name) {
    var text = 'Are you sure you want to delete "' + name + '"?';
    var noty = noty({
        text: text,
        buttons: [
        {addClass: 'btn btn-primary', text: 'Yes', onClick: function($noty) {
            $.post('/ajax/drafts/delete', {id:id}, function(data) {
                document.location.reload(true);
            });
            document.location.reload(true);
        }
        },
        {addClass: 'btn btn-danger', text: 'Cancel', onClick: function($noty) {
            $noty.close();
        }
        }
    ]});
}

当我使用它调用它时,delete_draft(10, "test")它给了我:

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
4

0 回答 0