Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

My site try to post a large ajax request to server, the request is rejected. Tested the same scenario in IE and Chrome, and both of them working.

  • 1 trả lời
  • 1 gặp vấn đề này
  • 14 lượt xem
  • Trả lời mới nhất được viết bởi philipp

more options

In my site, I had a button that will trigger a Ajax post to my server. When my data is with the content-length "32109", the post will rejected with a empty body response with xhr.statusText "error". If my content-length is "27549", i'm able to post successfully to my server.

Tested the same scenario in IE and Chrome and both working fine with content-length "32109".

Code:


$.ajax({

           url: "update",
           dataType: "json",
           data: {
               parameter_data: JSON.stringify({
                   meta_datas: metaDataObj,
                   attributesValues: this.data
               })
           },
           type: "POST",
           success: function(data) {
               ...
           },
           error: function (xhr, desc, err) {
               ...
           }
       });


Request headers:


User-Agent:"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0" Accept:"application/json, text/javascript, */*; q=0.01" Accept-Language:"en,zh;q=0.8,sq;q=0.6,zh-TW;q=0.4,en-US;q=0.2" Accept-Encoding:"gzip, deflate" Content-Type:"application/x-www-form-urlencoded; charset=UTF-8" X-Requested-With:"XMLHttpRequest" Content-Length:"32109" Connection:"keep-alive" Pragma:"no-cache" Cache-Control:"no-cache"

The response body is empty.

xhr:

- state = rejected
- statusText = error

May i know why the request is rejected? Note: The request never reach the server

In my site, I had a button that will trigger a Ajax post to my server. When my data is with the content-length "32109", the post will rejected with a empty body response with xhr.statusText "error". If my content-length is "27549", i'm able to post successfully to my server. Tested the same scenario in IE and Chrome and both working fine with content-length "32109". Code: --------------------------------------------------------------------------------------------------------------------------------------- $.ajax({ url: "update", dataType: "json", data: { parameter_data: JSON.stringify({ meta_datas: metaDataObj, attributesValues: this.data }) }, type: "POST", success: function(data) { ... }, error: function (xhr, desc, err) { ... } }); Request headers: --------------------------------------------------------------------------------------------------------------------------------------- User-Agent:"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0" Accept:"application/json, text/javascript, */*; q=0.01" Accept-Language:"en,zh;q=0.8,sq;q=0.6,zh-TW;q=0.4,en-US;q=0.2" Accept-Encoding:"gzip, deflate" Content-Type:"application/x-www-form-urlencoded; charset=UTF-8" X-Requested-With:"XMLHttpRequest" Content-Length:"32109" Connection:"keep-alive" Pragma:"no-cache" Cache-Control:"no-cache" The response body is empty. xhr: - state = rejected - statusText = error May i know why the request is rejected? Note: The request never reach the server
Đính kèm ảnh chụp màn hình

Tất cả các câu trả lời (1)

more options

hi, support.mozilla.org is intended for end-user support. if you have a question regarding web development please refer to Where to go for developer support instead. thank you for your understanding!