将大型参数化数据集作为 GET 请求发送

编程入门 行业动态 更新时间:2024-10-27 22:34:24
本文介绍了将大型参数化数据集作为 GET 请求发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

通过 GET 请求发送大型数据集的最佳方式是什么.

What's the best way to send a large data set via a GET request.

  • 由于某些设计限制,我无法使用 POST.
  • 我可以使用 jQuery 或任何其他库,最好使用 sizzle.
  • 我有一个复杂的数据集,其中包含嵌套,而 json 非常符合要求.

感谢您的帮助.

推荐答案

由于浏览器和服务器的限制,GET 请求的大小不应超过 1-4 KB.您必须将您的请求分成几块才能做到这一点.

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.

如果数据来自表单,例如,您可以使用 jQuery 的 .serialize() 函数将数据放入一个字符串中.然后将字符串拆分为千字节大小的块并使用 Ajax 将其发送出去.您必须有一个服务器端脚本将块重新粘合在一起,可能使用在 Ajax 请求中指定的唯一标识符.

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:Internet Explorer 中的最大 URL 长度为 2083 个字符
  • 各种服务器和浏览器测试,从 2006 年开始,但仍应给出一半-way代表概述
  • 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 请求发送

本文发布于:2023-10-29 13:25:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1539811.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!