Java 脚本(使用Can`t get json object to with knockout answer {1} 方法获取数据):
<script type="text/javascript">
$.getJSON("/api/TelemarketingApi", function (result) {
function viewModel() {
return ko.mapping.fromJS(result);
};
ko.applyBindings(new viewModel());
})
.error(function () { alert("error"); });
</script>
JSON对象:
[
{
"TelemCalls": [ {"ID": 1, "duratio": "11"}],
"ID": 1,
"FirstName": "Jonas",
"LastName": "Jonaitis",
"Phone": "860123123",
"Municipality": null
}
]
如何在剃须刀页面中访问和显示映射的 JSON 数据?