使用大量数据给出x.support.cors.e.crossDomain.send错误 [英] giving x.support.cors.e.crossDomain.send error with large amount of data

查看:106
本文介绍了使用大量数据给出x.support.cors.e.crossDomain.send错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的aspx代码页面中有一个webmethod用于获取员工每日报告,我通过AJAX和JSON将结果绑定到表中..



我的问题当我选择单个员工并通过AJAX获取其数据时,它可以正常工作,但当我选择所有员工(126),这给我输出大约4000条记录时,它给我错误

I have one webmethod in my aspx code behind page for getting employees daily report, i am binding that result into table through AJAX and JSON..

My problem is when i select single employee and get its data through AJAX it works properly , but when i select all employees (126) which gives me output of around 4000 records it gives me error of

x.support.cors.e.crossDomain.send



我的ajax是:


my ajax is :

$.ajax({
   type: "POST",
   data: params,
   url: "../Sales/AdminDARReport.aspx/GetDARReport",
   contentType: "application/json; charset=utf-8",
   dataType: "json",
   success: function (res) {
      console.log(res.d);
      // alert(res.d.length);
   },error:function(res,msg,code){}
});





我的webmethod是:



My webmethod is :

[WebMethod]
public static List<DARReport> GetDARReport(string darfor, string employeeid, string fromdate, string todate)
{
   List<DARReport> dr = new List<DARReport>();
   try
   {
      SQLDataAccessHelper sq = new SQLDataAccessHelper();
      SqlParameter[] param = new SqlParameter[3];
      param[0]=new SqlParameter("@fromdate_o", SqlDbType.NVarChar);
      param[0].Value = fromdate;
      param[1] = new SqlParameter("@todate_o", SqlDbType.NVarChar);
      param[1].Value = todate;
      param[2] = new SqlParameter("@userid", SqlDbType.NVarChar);
      param[2].Value = employeeid;
      DataSet ds = new DataSet();
      if (darfor.ToLower() == "reagent")
      {
         ds = sq.ExecuteDataSet("usp_admin_reagent_report", param);
         if ((ds != null) && (ds.Tables.Count != 0) && (ds.Tables[0].Rows.Count != 0))
         {
            ds.Tables[0].TableName = "DARREAGENT";

            for (int i = 0; i < ds.Tables[0].Rows.Count - 1; i++)
            {
               dr.Add(new DARReport {
                  dardate =ds.Tables [0].Rows[i]["DARDATE"].ToString (),
                  placeofwork = ds.Tables[0].Rows[i]["PLACEOFWORK"].ToString(),
                  reagentcall = ds.Tables[0].Rows[i]["REAGENTCALL"].ToString(),
                  instrumentcall = ds.Tables[0].Rows[i]["INSTRUMENTCALL"].ToString(),
                  jointvisitwith = ds.Tables[0].Rows[i]["JOINTVISITWITH"].ToString(),
                  pobvalue = ds.Tables[0].Rows[i]["POB"].ToString(),
                  remarks= ds.Tables[0].Rows[i]["REMARKS"].ToString(),
                  employeename= ds.Tables[0].Rows[i]["USERNAME"].ToString()
               });
            }
            dr.Add(new DARReport {
               averagereagentcall = ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["AVERAGECALLS"].ToString(),
               averagepob = ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["AVERAGEPOB"].ToString()
             });
         }
      }
   }
   catch (Exception ex) { throw ex; }
   finally { }
   return dr;
}



i刚刚对记录返回的数量做了警告,但是当数据很大时,它也没有提供计数警报...



请在这种情况下帮助我..



Krunal


i have just done alert for the number of records return but when the data is huge it doesnt gives alert for the count also...

please help me in this case..

Krunal

推荐答案

.ajax({
type: POST
data: params
url: ../ Sales / AdminDARReport.aspx / GetDARReport
contentType: application / json ; charset = utf-8
dataType: json
成功:函数(res){
console.log(res.d);
// alert(res.d.length);
},错误:函数(res,msg,代码){}
});
.ajax({ type: "POST", data: params, url: "../Sales/AdminDARReport.aspx/GetDARReport", contentType: "application/json; charset=utf-8", dataType: "json", success: function (res) { console.log(res.d); // alert(res.d.length); },error:function(res,msg,code){} });

< br $>


我的网络方法是:



My webmethod is :

[WebMethod]
public static List<DARReport> GetDARReport(string darfor, string employeeid, string fromdate, string todate)
{
   List<DARReport> dr = new List<DARReport>();
   try
   {
      SQLDataAccessHelper sq = new SQLDataAccessHelper();
      SqlParameter[] param = new SqlParameter[3];
      param[0]=new SqlParameter("@fromdate_o", SqlDbType.NVarChar);
      param[0].Value = fromdate;
      param[1] = new SqlParameter("@todate_o", SqlDbType.NVarChar);
      param[1].Value = todate;
      param[2] = new SqlParameter("@userid", SqlDbType.NVarChar);
      param[2].Value = employeeid;
      DataSet ds = new DataSet();
      if (darfor.ToLower() == "reagent")
      {
         ds = sq.ExecuteDataSet("usp_admin_reagent_report", param);
         if ((ds != null) && (ds.Tables.Count != 0) && (ds.Tables[0].Rows.Count != 0))
         {
            ds.Tables[0].TableName = "DARREAGENT";

            for (int i = 0; i < ds.Tables[0].Rows.Count - 1; i++)
            {
               dr.Add(new DARReport {
                  dardate =ds.Tables [0].Rows[i]["DARDATE"].ToString (),
                  placeofwork = ds.Tables[0].Rows[i]["PLACEOFWORK"].ToString(),
                  reagentcall = ds.Tables[0].Rows[i]["REAGENTCALL"].ToString(),
                  instrumentcall = ds.Tables[0].Rows[i]["INSTRUMENTCALL"].ToString(),
                  jointvisitwith = ds.Tables[0].Rows[i]["JOINTVISITWITH"].ToString(),
                  pobvalue = ds.Tables[0].Rows[i]["POB"].ToString(),
                  remarks= ds.Tables[0].Rows[i]["REMARKS"].ToString(),
                  employeename= ds.Tables[0].Rows[i]["USERNAME"].ToString()
               });
            }
            dr.Add(new DARReport {
               averagereagentcall = ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["AVERAGECALLS"].ToString(),
               averagepob = ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["AVERAGEPOB"].ToString()
             });
         }
      }
   }
   catch (Exception ex) { throw ex; }
   finally { }
   return dr;
}



i刚刚对记录返回的数量做了警告,但是当数据很大时,它也没有提供计数警报...



请在这种情况下帮助我..



Krunal


i have just done alert for the number of records return but when the data is huge it doesnt gives alert for the count also...

please help me in this case..

Krunal


这篇关于使用大量数据给出x.support.cors.e.crossDomain.send错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆