I am loading tab content data through jQuery\'s ajax post method via web method with around 200-300 records. And getting following error in the console:
I know this is a very old thread at the time of my reading, and that WebMethod is not really a thing in ASP.NET MVC so this is somewhat tangential. But, if anyone runs across it -
If you use ASP.NET MVC There is an alternative to invoking JavaScriptSerializer directly, which is to initialize the JsonResult and set the MaxJsonLength property on the result itself:
private JsonResult GetReallyBigJsonResult(object data, JsonRequestBehavior requestBehavior)
{
return new JsonResult()
{
ContentEncoding = Encoding.Default,
ContentType = "application/json",
Data = data,
JsonRequestBehavior = requestBehavior,
MaxJsonLength = int.MaxValue
};
}