开发者

xmlhttpreqeust fails in post/get but not in regular form submission

开发者 https://www.devze.com 2023-02-18 20:20 出处:网络
When using 开发者_运维技巧xmlhttpreqeust the post/get request fails when the data exceeded 7k. (HTTP error 400)

When using 开发者_运维技巧xmlhttpreqeust the post/get request fails when the data exceeded 7k. (HTTP error 400) When posting the same data using regular form submission ( etc . . .) it works well.

Is there a limit to data size when using xmlhttprequest? or extra setting is needed?

Dev Inv: NetBeans 6.9.1. Server: Tomcat 6. Browser: IE8.


When doing a GET, the data is limited by the length of the URL that the browser accept. Some versions of IE had a limit around 2 kB, so you should make sure that the data is well below that. A GET is simply not suited for sending a lot of data.

When doing a POST, the limit is much higher. The webserver has a default limit for the size of the request, which is typically something like 4 MB.

The same limits apply to a request using XMLHTTPRequest and posting a form. It's the method (POST/GET) that makes a difference for the limit.

0

精彩评论

暂无评论...
验证码 换一张
取 消