我正在尝试使用淘汰映射插件,但它没有将数据绑定到我的 UI。以下是我的代码:
var model;
$(document).ready(function () {
$.ajax({
type: "POST",
url: SERVER_PATH + '/jqueryservice/DataAccessService.asmx/GetData',
async: false,
data: "{ }",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result, status) {
model = ko.mapping.fromJS(result.d);
},
error: GetDataError
});
});
function GetDataError() {
alert("System is not responding at the moment. Please try again.");
}
谁能让我知道我在这里做错了什么?以下是从服务器返回的数据:
{"ID":903,"Name":"Camela Holding","Email":"Camelah@yahoo.com",
"Vehicles":[{"ID":1,"Name":"Van"},
{"ID":2,"Name":"Car"},
{"ID":4,"Name":"Cadillac"},
{"ID":5,"Name":"Train"}, {"ID":3,"Name":"Jeep"}],
"OwnerVehicle":0,"WeeklyData":null,"Week1":null}