我有以下的javascript代码:的Javascript插件Noty给出错误
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();
}
}
]});
}
当我从领事delete_draft(6, "this is it")
运行我得到这个错误
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
我该如何解决这个问题? Noty的网站是http://needim.github.com/noty/ 如果你认为它应该工作,评论。
'noty'是什么?在代码中'var noty = noty' noty as function as undefined。可能是你需要''var noty = function('? – Vsevolod 2012-08-11 21:41:09
@Vsevolod这就是为什么我把一个链接到底部的noty站点 – 2012-08-12 00:07:00
@“Mike G”我无法打开你的链接:-(你如何插入笔记。 js in your html? – Vsevolod 2012-08-12 00:25:36