0

我正在使用 $.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);
            });

杰森:

[
 {"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. 有什么我遗漏的吗?

4

1 回答 1

0

JSON 响应的大小没有设置限制,就像 HTML 或 XML 响应一样。您可以毫无问题地获得非常大的 JSON 响应。GET 与 POST 与此无关。这些只是请求发送到服务器的方式不同;GET 和 POST 的响应格式是相同的。

虽然在向服务器请求数据量大的情况下,首选 Post,但服务器的响应在 GET 和 POST 中都没有限制

于 2013-09-24T17:21:14.893 回答