我正在使用$ .getJson()函数返回位于单独的json文件中的数组,并将其存储到本地数组var中。我遇到的问题是我只能从json中取回25个项目中的20个。 $ .getJson是否对退回的项目数有限制?
这就是我使用代码的方式:
使用Javascript:
$.getJSON('data/gridData1.json',function(json){
console.log("Json length is: " + json.length);
var grid = json;
filterGrid(grid, ele);
});
JSON:
[
{"assignment":"Tom" , "cell":["Tom", "2013-10-06", "Client 3", "Activity", "Scheduled" ]}
,{"assignment":"Tom" , "cell":["Tom", "2007-10-06", "Client 2", "Alert" , "Work In Progress" ]}
,{"assignment":"Tom" , "cell":["Tom", "2013-10-06", "Client 3", "Activity", "In Progress" ]}
,{"assignment":"Tom" , "cell":["Tom", "2007-10-06", "Client 1", "Lead" , "Qualified" ]}
,{"assignment":"Tom" , "cell":["Tom", "2007-10-06", "Client 2", "Alert" , "Open" ]}
,{"assignment":"Jenny" , "cell":["Jenny" , "2007-10-06", "Client 1", "Notification" , "New" ]}
,{"assignment":"Jenny" , "cell":["Jenny" , "2007-10-06", "Client 3", "Lead" , "Qualified" ]}
,{"assignment":"Jenny" , "cell":["Jenny" , "2007-10-05", "Client 2", "Lead" , "Unqualified" ]}
,{"assignment":"Jenny" , "cell":["Jenny" , "2007-10-05", "Client 1", "Activity" , "In Progress" ]}
,{"assignment":"Jenny" , "cell":["Jenny" , "2007-10-05", "Client 3", "Lead" , "Qualified" ]}
,{"assignment":"Jenny" , "cell":["Jenny" , "2007-10-04", "Client 3", "Lead" , "Unqualified" ]}
,{"assignment":"Katie" , "cell":["Katie", "2007-10-06", "Client 2", "Activity" , "Draft" ]}
,{"assignment":"Katie" , "cell":["Katie", "2007-10-06", "Client 1", "Activity" , "Draft" ]}
,{"assignment":"Katie" , "cell":["Katie", "2007-10-06", "Client 2", "Activity" , "In Progress" ]}
,{"assignment":"Brad" , "cell":["Brad" , "2007-10-06", "Client 1", "Activity" , "Scheduled" ]}
,{"assignment":"Brad" , "cell":["Brad" , "2007-10-06", "Client 3", "Activity" , "Scheduled" ]}
,{"assignment":"Brad" , "cell":["Brad" , "2007-10-05", "Client 2", "Activity" , "In Progress" ]}
,{"assignment":"Brad" , "cell":["Brad" , "2007-10-05", "Client 1", "Alert" , "Work In Progress" ]}
,{"assignment":"Brad" , "cell":["Brad" , "2007-10-05", "Client 3", "Alert" , "Open" ]}
,{"assignment":"Brad" , "cell":["Brad" , "2007-10-04", "Client 3", "Notification" , "New" ]}
,{"assignment":"Hank" , "cell":["Hank", "2013-10-06", "Client 3", "Lead", "Unqualified" ]}
,{"assignment":"Hank" , "cell":["Hank", "2007-10-06", "Client 2", "Alert" , "Work In Progress" ]}
,{"assignment":"Hank" , "cell":["Hank", "2007-10-06", "Client 1", "Lead" , "Qualified" ]}
,{"assignment":"Hank" , "cell":["Hank", "2007-10-06", "Client 2", "Alert" , "Open" ]}
,{"assignment":"Mike" , "cell":["Mike" , "2007-10-04", "Client 3", "Notification" , "New" ]}
]
控制台日志显示结果:20。我有什么遗漏吗?
答案 0 :(得分:0)
JSON响应的大小没有设置限制,不仅限于此 在HTML或XML响应上。你可以拥有非常大的JSON响应而没有 问题。 GET与POST将与此无关。那些只是不同的 请求发送到服务器的方式; GET和GET的响应格式 POST是完全相同的。
虽然在向服务器请求大量数据的情况下,但首选Post,但服务器的响应在GET和POST中都没有限制