通过GET请求发送大型数据集的最佳方式是什么?
- 由于某些设计限制,我无法使用POST。
- 我可以使用jQuery或任何其他库,但最好使用sizzle。
- 我有一个嵌套在其中的复杂数据集,并且json符合该帐单很好。
感谢您的帮助。
解决方案由于浏览器和服务器的限制,GET请求的大小不应超过1-4千字节。如果数据来自表单,例如,您可以使用jQuery的 //api.jquery/serialize/rel =noreferrer> .serialize() 函数将数据放入一个字符串中。然后将字符串拆分为千字节大小的块并使用Ajax将其发送出去。您必须有一个服务器端脚本,将块组合在一起,可能使用Ajax请求中指定的唯一标识符。
长度限制的一些来源:
- MSDN:最大网址长度在Internet Explorer中为2083个字符 来自2006年的各种服务器和浏览器测试,但仍应提供一个中途代表性概览
What's the best way to send a large data set via a GET request.
- I cannot use POST because of some design limitations.
- I can use jQuery or any other library, sizzle is preferable.
- I have a complex data set that has nestings within it, and json fits the bill well.
Thanks for your help.
解决方案GET requests shouldn't exceed 1-4 kilobytes in size due to browser and server limitations. You would have to split your request in chunks to do this.
If the data comes from a form, you could, for example utilize jQuery's .serialize() function to put the data into one string. Then split the string into kilobyte-sized chunks and send it out using Ajax. You would have to have a server-side script that glues the chunks back together, possibly using a unique identifier specified in the Ajax requests.
Some sources on the length limitation:
- MSDN: Maximum URL length is 2083 characters in Internet Explorer
- Various server and browser tests, from 2006 but should still give a half-way representative overview
更多推荐
作为GET请求发送大型参数化数据集
发布评论