getJSON not working for large data

前端 未结 4 561
遥遥无期
遥遥无期 2020-12-22 00:13

In one of my website I am using $.getJSON(url, function (data) this is not working if the response data is more that 1000. Any alternate is there?

相关标签:
4条回答
  • 2020-12-22 00:29

    Just use $.post Instead of using $.getJSON

    0 讨论(0)
  • 2020-12-22 00:33

    This is probably a setting on your server. There is typically a maximum response size. Have you looked in Firebug to see if the response is actually getting to the browser?

    0 讨论(0)
  • 2020-12-22 00:41

    There are no size restriction in $.getJSON. Either you have problem on the server or you have timeout problems. $.getJSON is just a short form of $.ajax. Try to use $.ajax with the timeout parameter with the local timeout (in milliseconds) for the request (see http://api.jquery.com/jQuery.ajax/ for more information).

    0 讨论(0)
  • 2020-12-22 00:42

    If you're using asp.net Web Services there is a maximum size for the response.

    Thsi is a GOOD thing. Generally, you should be returning SMALL sized bits of things with AJAX.

    However, if you WANT to change this to the max, you could add this under the configuration section of the web.config. This is not recommended, mind you.

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

    A somewhat related SO question: Can I set an unlimited length for maxJsonLength in web.config?

    0 讨论(0)
提交回复
热议问题