我究竟做错了什么?我要做的就是从 API 获取一些数据并将其显示在屏幕上:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Kendo UI Test</title>
<link href="styles/kendo.common.min.css" rel="stylesheet" />
<link href="styles/kendo.default.min.css" rel="stylesheet" />
<script src="js/jquery.min.js"> </script>
<script src="js/kendo.web.min.js"> </script>
</head>
<body>
<div id="grid"></div>
<script type="text/javascript">
$(document).ready(function()
{
var retrievedData = new kendo.data.dataSource({
transport: {
read: {
url: "http://puppygifs.tumblr.com/api/read/json",
dataType: "json"
}
}
});
$("#grid").kendoGrid({
dataSource: retrievedData,
pageSize: 10
});
});
</script>
</body>
</html>
错误发生在这部分:
var retrievedData = new kendo.data.dataSource({
transport: {
read: {
url: "http://puppygifs.tumblr.com/api/read/json",
dataType: "json"
}
}
});
编辑:
我将如何修改代码以从如下所示的对象中捕获数据:
[
{
<NotificationNode>k__BackingField: {
isDirty: false,
isRecordAdded: false,
isRecordDeleted: false,
<CaseStatus>k__BackingField: null,
<CaseName>k__BackingField: null,
<CaseType>k__BackingField: null,
<CaseStage>k__BackingField: null,
<CaseNotificationId>k__BackingField: 0,
<CaseId>k__BackingField: 0,
<Comments>k__BackingField: null,
<WarningDays>k__BackingField: 0,
<NotificationDate>k__BackingField: "0001-01-01T00:00:00",
<LetterUrl>k__BackingField: null,
<NotificationId>k__BackingField: 0,
<NotificationDescription>k__BackingField: null,
<NotificationCount>k__BackingField: 1889,
<ParamValue1>k__BackingField: null,
<ParamValue2>k__BackingField: null,
<ParamValue3>k__BackingField: null,
<ParamValue4>k__BackingField: null,
<ParamValue5>k__BackingField: null,
<NotificationStatus>k__BackingField: 0,
<Checked>k__BackingField: false,
notificationTypeId: 1,
notificationType: "Add/Edit Gross Earnings",
actionPageName: null,
param1: null,
param2: null,
param3: null,
param4: null,
param5: null,
dateEntered: "0001-01-01T00:00:00",
whoEntered: 0,
dateChanged: "0001-01-01T00:00:00",
whoChanged: 0
},
<Notifications>k__BackingField: [ ],
<IsExpanded>k__BackingField: false
},