简体   繁体   English

xmlhttpreqeust在发布/获取时失败,但在常规形式提交中失败

[英]xmlhttpreqeust fails in post/get but not in regular form submission

When using xmlhttpreqeust the post/get request fails when the data exceeded 7k. 当使用xmlhttpreqeust时,如果数据超过7k,则发布/获取请求失败。 (HTTP error 400) When posting the same data using regular form submission ( etc . . .) it works well. (HTTP错误400)使用常规表单提交(例如..)发布相同的数据时,它工作得很好。

Is there a limit to data size when using xmlhttprequest? 使用xmlhttprequest时,数据大小是否有限制? or extra setting is needed? 还是需要额外的设置?

Dev Inv: NetBeans 6.9.1. 开发人员:NetBeans 6.9.1。 Server: Tomcat 6. Browser: IE8. 服务器:Tomcat6。浏览器:IE8。

When doing a GET, the data is limited by the length of the URL that the browser accept. 进行GET时,数据受浏览器接受的URL长度的限制。 Some versions of IE had a limit around 2 kB, so you should make sure that the data is well below that. 某些版本的IE的限制大约为2 kB,因此您应确保数据远低于该限制。 A GET is simply not suited for sending a lot of data. GET根本不适合发送大量数据。

When doing a POST, the limit is much higher. 进行POST时,限制会更高。 The webserver has a default limit for the size of the request, which is typically something like 4 MB. Web服务器对请求的大小有一个默认限制,通常为4 MB。

The same limits apply to a request using XMLHTTPRequest and posting a form. 相同的限制适用于使用XMLHTTPRequest并发布表单的请求。 It's the method (POST/GET) that makes a difference for the limit. 是方法(POST / GET)使限制有所不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM