您好我正在尝试修改jsGrid演示中的“DataManipulation”示例,我无法使用GET ajax调用显示来自json文件的数据。这是我的控制器代码:
{
loadData: function (filter) {
var data = $.Deferred();
$.ajax({
type: "GET",
contentType: "application/json",
url: "myFileURL.json",
dataType: "json"
}).done(function(response){
console.log(response);
data.resolve(response);
});
return data.promise();}
json重新审视就像这样
{"98762":{"Address":"Address 1","Age":1,"Country":1,"Married":false,"Name":"Name1"},"637399":{"Address":"Address 2","Age":2,"Country":2,"Married":true,"Name":"Name 2"},"234567554":{"Address":"Address 3","Age":3,"Country":3,"Married":true,"Name":"Name"}}
答案 0 :(得分:1)
你的json不是很好。 jsGrid期望一个对象列表作为返回类型。请改用它。
foo.obj: foo.c
....
这是假设json的模式是正确的。祝你好运!