在我的MVC 应用程序中,我getJSON
用于一些服务器调用。但是它们不起作用。深埋在它打破的 jquery 1.4.2 库中。对于 e 对象username
和密码不存在。然而,在$.getJson
我看到的文档中,没有username
我应该注意的密码。那么下面的代码有什么问题呢?
var dataService = new function () {
$.ajaxSetup ({
cache: false
});
addBusinessUnit = function(employeeId, businessUnitId, callback) {
$.getJSON('<%= Url.Action("AddBusinessUnitForDepartmentAdministrator", "DataService")%>',
{ employeeId: employeeId, businessUnitId: businessUnitId },
function(data) {
callback(data);
});
},
deleteBusinessUnit = function(employeeId, businessUnitId, callback) {
$.getJSON('<%= Url.Action("DeleteBusinessUnitForDepartmentAdministrator", "DataService")%>',
{ employeeId: employeeId, businessUnitId: businessUnitId },
function(data) {
callback(data);
});
};
return {
addBusinessUnit: addBusinessUnit,
deleteBusinessUnit: deleteBusinessUnit
};
} ();
编辑:
这是我的服务器端代码。
public ActionResult AddBusinessUnitForDepartmentAdministrator(
int employeeId, int businessUnitId)
{
var input = new DepartmentAdministratorExtraDepartment(employeeId, businessUnitId);
return new JsonResult
{
Data = input.AddNewPermission(),
JsonRequestBehavior = JsonRequestBehavior.AllowGet
};
}