开发者

Is there a size limit to the amount of data returned by an Ajax Request?

I've been having this problem in the Chrome browser.

i use jquery's开发者_Python百科 ajax post. Ajax is supposed to return a really long raw html.

When I do it in FF3 and IE8 it works fine. But in chrome the data seems to be truncated.


I do not have many details about the raw HTML, but I would like to share what I found to be true in the applications I worked on:

  1. There is no limit to the amount of data you receive via AJAX request
  2. However, if the amount of data being requested is very long it can time-out
  3. If you are calling an entire HTML page, and it has script tags in the header, this can cause problems if you try to set it inside a div on the page itself. If this is the case, then set the script tags inside the body tag and it will work.

If this is not helpful, please feel free to provide a little more information about the raw HTML


As of what i know, there is limit of 4kb. However this is also browser-dependent.


It may also run into server-side size limits as well as client or server side time-out limits. Depending on the platforms and browsers these limits can be quite different for ajax requests than they are for standard browser requests too.

I would recommend that you use an iframe to contain the HTML, and use ajax to control the iframe's source. When you need to load the HTML, just have javascript point the iframe at a URL that will produce that HTML. This way you are only limited by the regular HTML request timeout and size limits, not the (sometimes) more restrictive ajax limits.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜