1

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?

Liam
  • 27,717
  • 28
  • 128
  • 190
Saravanan I M
  • 1,115
  • 2
  • 19
  • 29
  • for a better performance we use paging or any similar technique, like "show next items", or maybe lazy loading – Luke Feb 02 '11 at 16:18

4 Answers4

4

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?

Keith Rousseau
  • 4,435
  • 1
  • 22
  • 28
2

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).

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • `$.ajax` also exposes an `error` event where you might be able to check out the XHR object and get more details about what went wrong. – Chris Farmer May 26 '10 at 17:47
  • @Chris: Exactly. One can also define `error`event handle and so on. – Oleg May 26 '10 at 17:59
0

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?

Community
  • 1
  • 1
Armstrongest
  • 15,181
  • 13
  • 67
  • 106
0

Just use $.post Instead of using $.getJSON

amesh
  • 1,311
  • 3
  • 21
  • 51