开发者

What's the size limit for the return value of a jQuery ajax call?

开发者 https://www.devze.com 2023-02-07 12:38 出处:网络
It would appear that there is a size limit on the return value of a jQuery ajax call of around 70K. Can anyone verify this? I\'m trying to return a longer string than that from ASP.NET. The HTML I\'m

It would appear that there is a size limit on the return value of a jQuery ajax call of around 70K. Can anyone verify this? I'm trying to return a longer string than that from ASP.NET. The HTML I'm returning displays up until I get to around that size. After that, nothing displays on my page. I'm not seeing an error message and I don't see this documented anywhere. Here's my ajax call.

 $.ajax(
            {
                type: "POST",
                url: _urlGetCandidatesForAdvancedSearch,
                data: searchCriteria,
                contentType: "application/json; charset=utf-8",
                dataType: "json",
      开发者_如何学JAVA          success: function (msg)
                {
                    ShowSearchResults(msg.d);
                },
                error: function (xhr, ajaxOptions, thrownError)
                {
                    HideBusyIcon();
                    alert(thrownError.toString());
                }
            }
            );

Thanks, Jay


jQuery $.ajax() does not have a limit (as far as I am aware) but ASP.NET does have a limit:

<system.web.extensions>  
    <scripting>  
        <webServices>  
            <jsonSerialization maxJsonLength="x"></jsonSerialization>  
        </webServices>  
    </scripting>  
</system.web.extensions>


I've never hear of an arbitrary limit on AJAX calls are you sure there's not something else going on? 70K doesn't sound like a lot to me so even if there was such a limit, and I'm not saying there is, it would be at least a couple of 100K.

Are you sure that there's nothing wrong with your data?

FYI the default maxJsonLength value is 102400 (the maximum number of UTF-8 characters, [that translates to bytes in my opinion]) that's 100K. Could very well be that the response is just that big. Though 70K is below that limit...

0

精彩评论

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