jquery ajax return value limit

I have been playing a bit with jquery and ajax and came across a very interesting “by design” issue. I built a simple responsive HTML page that populates a data table via a ajax service that returns a JSON string. Everything worked fine until I tried populating a slightly bigger table. My $.ajax call went through fine but it failed to call the success or error function I specified.

After trying various different things I thought that perhaps it could be related to a timeout or request size issue. Bottom line…asp.net has a default size limit when returning data from a service (not a 100% sure but about 102400 characters). Easy one to solve\override, just add the snippet below to your web.config

<jsonSerialization maxJsonLength=”2147483647″></jsonSerialization>

Obviously you do not have to use 2147483647 (Int32 max) but hey, if you are going to override something, do it PROPERLY

Leave a Reply

Your email address will not be published. Required fields are marked *