Sending a large parametrized data set as a GET request

十年热恋 提交于 2020-01-11 09:22:06

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/2977070/sending-a-large-parametrized-data-set-as-a-get-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!