我正在使用JQuery ajax选项为DataTables加载数据,这是我的代码,
$("#employeeTable").DataTable({
"ajax": {
"url": "/Parameter/GetEmployeeData",
"type": "GET",
"processing": true,
"datatype": "JSON",
"serverSide": true
},
"columns": [
{
"data": "ID", "render": function (data) {
return `<button type="button" onclick="location.href='@Url.Action("Edit", "Parameter")/${data}'" class="btn btn-warning">Edit</button>`
},
orderable: false
},
{ "data": "PARAMETER_ID" },
{ "data": "LoanType.LOAN_TYPE_DESC" },
{ "data": "REPAYMENT_SCORE" },
{ "data": "CREDIT_RISK_GRADE" },
{ "data": "CRIB_STATUS" }
]
}).fnDestroy();
当我在VS中运行代码时,此代码工作正常。在IIS服务器中发布我的应用程序之后。发生以下错误。
DataTables警告:表id = employeeTable-Ajax错误。欲了解更多 有关此错误的信息,请参见http://datatables.net/tn/7
这是我的参数控制器GetEmployeeData()
方法
public JsonResult GetEmployeeData()
{
var employeeList = cutOffMarks.GetCutoffMarksList().OrderByDescending(x => x.PARAMETER_ID);
return Json(new { data = employeeList }, JsonRequestBehavior.AllowGet);
}