我正在尝试使用Chrome中的Ajax发送呼叫,这是上升错误。它不能调用该方法。
function BuildTree() {
$.ajax({
type: 'POST',
url: "/Payroll/GetTreeData",
async: false,
data: "{'mainItem':'2'}",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (data) {
if (data) {
$('#tree').treeview({
data: data,
enableLinks: true,
showBorder: false,
onNodeSelected: function (event, data) {
if (data.tags instanceof Array) {
//DoStuffWhenClickingOnNode(data.tags[0]);
//alert("Action done!");
$.ajax({
type: "POST",
url: "@Url.Action("GetPaysheet", "Payroll")",
data: JSON.stringify({ Sheet_ID: data.tags[0] }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
location.reload();
}
});
}
}
});
}
},
error: function (error) {
alert(error.responseText);
}
});
public ActionResult GetPaysheet(string Sheet_ID)
{
DataUtility dUtil = new DataUtility();
DataTable payTable = dUtil.Get_DataTable("Select s.*, d.Dept_Name From PaySheet s Left Join Department d On s.Dept_ID = d.Dept_ID Where isnull(s.Parent_Sheet_ID,0)<>0 And s.Sheet_ID = " + Sheet_ID);
objModelLists.PaySheet = payTable;
return View(objModelLists);
}