大小限制的一个jQuery或JavaScript的AJAX GET方法的返回值? [英] Size limit for the return value of a jQuery or JavaScript ajax get method?

查看:69
本文介绍了大小限制的一个jQuery或JavaScript的AJAX GET方法的返回值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用AJAX GET方法,是有大小限制的返回值?

When I use an ajax GET method, is there a size limit for the return value?

如果是这样,这个限制是由于使用Javascript / jQuery的?浏览器?到服务器?

If so, is this limit due to JavaScript/jQuery? To the browser? to the server?

我所看到的较早的文章(5+岁)似乎表明,有一个大小的限制,但我无法找到关于此主题的任何新的信息。

I have seen older articles (5+ years old) that seem to indicate that there was a size limit, but I couldn't find any recent information on this topic.

推荐答案

HTTP协议并不限制任何响应的大小,和同样没有jQuery的本身。因此从理论上讲,你可以只要你想你的GET回应大。

The HTTP protocol does not limit the size of any response, and neither does jQuery itself. So theoretically speaking, you can make your GET response as big as you want.

然而在实践中,存在的的一些限制:Web服务器可能有一个最大响应大小(特别是当你缓存整个响应),服务器code可能需要中间处理步骤需要额外的存储,客户端需要处理它以前在什么地方存储响应数据,在JavaScript实现上的浏览器可能有额外的内存限制(您不希望恶意的脚本吃了你所有的物理内存:这将是一个严重的安全问题)。多少钱到底是太多为pretty的难以确定,虽然:几兆可能是OK,一兆兆字节肯定是不

In practice, however, there are some constraints: the web server may have a maximum response size (especially when you're caching entire responses), server code may need intermediate processing steps that require additional storage, the client needs to store the response data somewhere before processing it, the javascript implementation on the browser may have extra memory constraints (you don't want a rogue script eating up all your physical RAM: that would be a severe security problem). How much exactly is too much is pretty hard to pinpoint though: a few megabytes are probably OK, a terabyte certainly isn't.

请注意,该请求方法是在这种情况下pretty的无趣;上述问题也同样适用于POST请求的响应,或者任何其他HTTP动词

Note that the request method is pretty uninteresting in this context; the above issues are just as valid for responses to POST requests, or any other HTTP verb.

这篇关于大小限制的一个jQuery或JavaScript的AJAX GET方法的返回值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆