[Solved] jQuery AJAX JSON Array not returning from Web Service for large data

Last Reply one year ago By merajhkbk

Posted one year ago

This code perfectly work for below 225 rows of records only..... how can i get the record more then 225...

 

 

[WebMethod]
        public eval_list[] Bind_gv_eval_WM(string emp_id)
        {
            string lang = "eng";
            if (HttpContext.Current.Request.Cookies["hrmsRiyadhFoods"]["lang"] == "Arabic")
                lang = "ar";
 
            SelectQuery sq = new SelectQuery();
            SqlParameter[] param = { new SqlParameter("@emp_id", SqlDbType.VarChar, 10) { Value = emp_id} ,
                                   new SqlParameter("@lang", SqlDbType.VarChar, 3) { Value =lang }
                                   };
            DataSet ds = sq.fnSelectQueryUsingStoredProc("Evaluation_Details", "hrms", param);
 
            List<eval_list> list = new List<eval_list>();
            foreach (DataTable table in ds.Tables)
            {
                foreach (DataRow row in table.Rows)
                {
                    eval_list lst = new eval_list();
                    lst.date = Convert.ToString(row["Date"]);
                    lst.total = Convert.ToDecimal(row["Total"]);
                    lst.result = Convert.ToString(row["Result"]);
                    lst.mgr_remark = Convert.ToString(row["MGR Remark"]);
                    list.Add(lst);
                }
            }
            return list.ToArray();
        }

 

function Bind_gv_eval(emp_id) {
            $.ajax({
                type: "POST",
                url: "../my_ws.asmx/Bind_gv_eval_WM",
                data: '{emp_id: "' + emp_id + '" }',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#tbl_eval tr").remove();
                    $("#tbl_eval").append("DateTotalResultMGR. Remark");
                    if (data.d.length > 0) {
                        for (var i = 0; i < data.d.length; i++) {
                            $("#tbl_eval").append("" + data.d[i].date + "" + data.d[i].total + "" + data.d[i].result + "" + data.d[i].mgr_remark + "");
                        }
                    }
                    else {
                        $("#tbl_eval").append("No previous evaluation record found");
                    }
 
                },
                failure: function (result) {
                    alert(result.d);
                }
            });
        }

 

Posted one year ago

Hi merajhkbk,

Are you getting any error. Please check the browser console window from error details.

Else try to increase the JsonLength and check. For this refer the below article.

ASP.Net AJAX Error: The length of the string exceeds the value set on the maxJsonLength property


Posted one year ago

thank you dharmendr...thank you very much.. below code solved my problem

 

 
<system.web.extensions>
    <scripting>
        <webServices>
            <jsonSerialization maxJsonLength="819200000" />
        </webServices>
    </scripting>
</system.web.extensions>