显示ajax调用返回数据 [英] dispaly ajax call return data
本文介绍了显示ajax调用返回数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HI,
我正在尝试学习MVC。我有一个列表页面,其中有一个复选框,当我点击它我做了一个ajax方法从SQL获取数据。返回的数据是DataTable格式。我如何从中读取内容并显示结果。
这是我所做的代码。这是控制器
I am trying to study MVC. I have a list page where there is a checkbox, when i click it i made an ajax method to fetch data from SQL. The returned data is of DataTable format . How can i read contents from that and display the result.
This is the code i have done. This is the controller
[HttpPost]
public JsonResult Index(bool includeInActive = false, string searchKey = "", string sortField = "ID", string sortDirection = "asc")
{
objEmployee = new Employee();
try
{
objEmployee.GetEmployees(sortField, sortDirection, searchKey, includeInActive);
return Json(objEmployee.dtEmployees, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
throw ex;
}
}
请帮助我。
Pls help me.
推荐答案
这篇关于显示ajax调用返回数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文