Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript $.getJson()响应限制_Javascript_Jquery - Fatal编程技术网

Javascript $.getJson()响应限制

Javascript $.getJson()响应限制,javascript,jquery,Javascript,Jquery,我使用$.getJson()函数返回一个位于单独json文件中的数组,并将其存储到本地数组变量中。我遇到的问题是,我只从json返回了总共25个项目中的20个。$.getJson对返回的项目数量有限制吗 以下是我使用代码的方式: Javascript: $.getJSON('data/gridData1.json',function(json){ console.log("Json length is: " + json.length);

我使用$.getJson()函数返回一个位于单独json文件中的数组,并将其存储到本地数组变量中。我遇到的问题是,我只从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:


控制台日志显示结果:20。有什么我遗漏的吗?

对JSON响应的大小没有设置限制,就像没有设置限制一样 在HTML或XML响应上。您可以有非常大的JSON响应,而不需要 问题 GET vs.POST与此无关。这些只是不同的地方 请求发送到服务器的方式;GET和GET的响应格式 帖子是一样的


虽然在向服务器请求大量数据的情况下,Post是首选,但来自服务器的响应在GET和Post中都没有限制。getjson()只是
.ajax()
的包装,并假定来自服务器的JSON响应。它没有内在的限制。如果你只得到20个元素,那么服务器只发送20个元素。是的,我刚刚再次运行了它,现在它显示了所有内容。我一开始不知道它为什么不起作用,因为我没有做任何改变。
[
 {"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" ]}
]