Hilfe durchsuchen

Vorsicht vor Support-Betrug: Wir fordern Sie niemals auf, eine Telefonnummer anzurufen, eine SMS an eine Telefonnummer zu senden oder persönliche Daten preiszugeben. Bitte melden Sie verdächtige Aktivitäten über die Funktion „Missbrauch melden“.

Learn More

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 Antwort
  • 1 hat dieses Problem
  • 13 Aufrufe
  • Letzte Antwort von 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
Angefügte Screenshots

Alle Antworten (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!