例如:下面代码有两个int类型的参数,如果Ajax调用时没有在data属性中为其赋值,AJAX会出500异常。

public JsonResult GetList(int pageIndex, int pageSize)
        {
            int total = 0;
            List<ModelEmployeeList> list = BllEmployee.GetList(out total, 1, 10);
            return new JsonResult()
            {
                Data = new ModelCommonJsonResult() { flag = 1, data = new ModelCommonSfDataGridResult() { rows = list, total = total } },
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }

尽量避免使用int类型,可以使用int?或是用类来接受一组数据。

相关文章:

  • 2021-04-11
  • 2021-07-15
  • 2021-10-17
  • 2021-04-06
  • 2021-11-19
  • 2021-09-16
  • 2022-12-23
  • 2022-01-30
猜你喜欢
  • 2021-09-28
  • 2021-11-29
  • 2022-12-23
  • 2021-12-11
  • 2021-11-11
  • 2021-06-14
相关资源
相似解决方案