0

I am calling post request through ajax.It is working fine for small data but it gives Readystate 4,status 200,parse error for large data JSON.Following is my java script...


$.ajax({
            url: '@Url.Action("GetCompanyTicketsGrid")',
            dataType: "json",
            type: "post",
            data: { companyUserID: userId, globalRoleId: roleId },
            success: function (res) {
                $gridUser.empty();
                var len = res.rows.length;
                if (len > 0) {
                    $("#errorDiv").hide();
                    for (var i = 0; i < len; i++) {
                      //some work
                    }
                }
                else
                    $("#errorDiv").show();
            },
            error: function (a, b) {
                alert("User Data: " + b);
            }
        });

When i return JSON with more than 5000 records then only i m getting that error. Thanks in advance.

Sudhir Bastakoti
  • 97,363
  • 15
  • 155
  • 158
Kavita
  • 1
  • 1
  • 2
  • Your url may be returning null on that case. Returning null from a server side call returns a response with status code 200, "Ok", but jQuery throws a parseerror afterwards. Might that be your case..? – Sudhir Bastakoti Mar 06 '12 at 07:17
  • Have a look at this question: http://stackoverflow.com/questions/6186770/ajax-request-return-200-ok-but-error-event-is-fired-instead-of-success/6186905#6186905 – Salman A Mar 06 '12 at 07:18
  • So, the error is in one (or more) of those 5000+ records. Can you narrow it down, e.g., divide and conquer? – John Pick Mar 06 '12 at 07:26
  • use json validator for your response to track the error down. – eis Oct 08 '14 at 14:18
  • Possible duplicate of [Ajax request returns 200 OK, but an error event is fired instead of success](http://stackoverflow.com/questions/6186770/ajax-request-returns-200-ok-but-an-error-event-is-fired-instead-of-success) – Andrei Epure is hiring Mar 23 '17 at 12:45

0 Answers0