MVC3 (.cshtml File)
$.getJSON(URL, Data, function (data) {
document.getElementById('divDisplayMap').innerHTML = data;
if (data != null) {
$('#myTablesId').show();
tdOnclickEvent();
}
else {
$('#myTablesId').hide();
}
}).error(function (xhr, ajaxOptions, thrownError) { debugger; });
on Server Side
public JsonResult ZoneType_SelectedState(int x_Id, int y_Id)
{
JsonResult result = new JsonResult();
result.Data = "LongString";//Longstring with the length mention below
return Json(result.Data,"application/json", JsonRequestBehavior.AllowGet);
}
from the server side i am passing the string with the length of 1194812 and more than that. but i am getting the error saying the
"Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property."
Please help me out ASP
Try to update your
Controller
method as shown below:Hope this helps...
You could write a custom ActionResult which will allow you to specify the maximum length of data that the serializer can handle:
and then use it: