【发布时间】:2013-08-02 23:31:25
【问题描述】:
现在正在运行。以下是此代码的修改版本。 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
【问题讨论】:
-
这个问题现在已经修复,我已经相应地修改了我的问题。
-
我不确定如何将此问题标记为已修复。请关闭此问题。
标签: knockout.js