0

I am getting an error when sending an array with a length greater than 250 to MVC controller. It works when array length is less than 250 items.

Client Code

function saveVD() {
    var arr = [];
    $.each($("#tablevd tbody tr"), function () {
        arr.push({
                invNo: $(this).find('td:eq(0)').html().trim(),
                invDate: $(this).find('td:eq(1)').html().trim()
            })
    })
    $.ajax({
            contentType: 'application/json; charset=utf-8',
            dataType: 'json',
            type: 'POST',
            url: "@Url.Action("Absorb","My")",
            data: JSON.stringify({ 'arr': arr }),
            success: function (result) {
            },
            error: function () {
            }
        })
}

Server Code

public class MyController : Controller
{
    [HttpPost]
    public JsonResult Absorb(CIVM[] arr)
    {
        return Json(true, JsonRequestBehavior.AllowGet);
    }
}
public class CIVM
{
    public string invNo { get; set; }
    public DateTime invDate { get; set; }
}
3
  • 2
    Can you post the error you are getting so we can answer more precisely? Commented Jan 20, 2020 at 11:56
  • 1
    possible duplicate of stackoverflow.com/questions/18622106/… Commented Jan 20, 2020 at 12:21
  • I have got the solution . Thanks Commented Jan 21, 2020 at 5:55

1 Answer 1

1

Below config changes may help you

<appSettings>
    <add key="aspnet:MaxJsonDeserializerMembers" value="150000" />
</appSettings>
Sign up to request clarification or add additional context in comments.

1 Comment

This is an exact copy of 'stackoverflow.com/questions/18622106/…'...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.