これは現在動作しています。以下は、このコードの修正版です。var data = $.getJSON("URL", null, function (result) {
var notes = function () {
self = this;
self.notes = ko.observableArray(result);
self.deleteNote = function (note) {
$.ajax({
url: "URL" + this.ID,
dataType: "json",
type: "GET",
success: function (d) {
self.notes.remove(note);
}
});
};
self.addNote = function () {
var note = $("#txtNote").val();
$.ajax({
url: "URL",
type: "POST",
data: { 'note': note },
datatype: "json",
success: function (data) {
self.notes.push({ Description: note, ID: data.ResponseData.id, CreateDate: data.ResponseData.createDate });
}
});
}
}
ko.applyBindings(new notes());
});
ありがとう、JSHunjan