我有以下的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