Mam następujący kod javascript:JavaScript podłączyć Noty daje błąd
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();
}
}
]});
}
Kiedy biegnę z konsulem delete_draft(6, "this is it")
otrzymuję ten błąd
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
Jak mogę rozwiązać ten problem? Strona internetowa dla Noty to http://needim.github.com/noty/ Jeśli uważasz, że powinna zadziałać, skomentuj.
Co to jest 'noty'? w kodzie 'var noty = noty' noty, ponieważ funkcja jest niezdefiniowana. Być może potrzebujesz 'var noty = function ('? – Vsevolod
@Vsevolod Dlatego właśnie umieściłem link do strony z informacją pod butem –
@ "Mike G" Nie mogę otworzyć twojego linku :-(Jak podłączyć notatkę. js w tobie html? – Vsevolod