가 정렬 기다리고 있었다 그 '안녕하세요'대신에 다음 얻고있다
"{\"Content\":\"hello world\"}"
JS에게 아약스 호출에서
function ViewModel() {
var self = this;
self.message = ko.observable();
$.getJSON("/home/getmessage", function (response) {
var mapped = ko.mapping.fromJSON(response);
self.message(mapped.Content);
});
};
ko.applyBindings(new ViewModel());
을 반환 ko.mapping이 observables를 반환한다는 사실을 간과 했으므로 값을 얻기 위해 observables를 함수로 호출해야합니다.
function viewModel() {
var self = this;
self.content = ko.observable();
$.getJSON("/home/getmessage", function (response) {
var mapped = ko.mapping.fromJSON(response);
self.content(mapped.Content());
});
}
ko.applyBindings(new viewModel);