Uncaught TypeError:Undefined is not a function
当我尝试在我的家庭控制器中调用方法时,我收到了这条消息。
关于我为什么收到此消息的建议?
findIdpActivities = function (pernr, callback) {
restEndPoint = serviceBase + 'Home/FindIdpActivities';
data = "{'perNr':'" + pernr + "'}";
makeJsonDataAjaxCall(callback);
};
makeJsonDataAjaxCall = function (callback, obj) {
$.ajax({
type: "POST",
url: restEndPoint,
contentType: "application/json; charset=utf-8",
dataType: "json",
data: data,
success: function (data) {
callback(data);
}
});
};
单击按钮时执行该方法。
$(document).on("click", "input[name=btnViewActivities]", function (e) {
e.preventDefault();
var value = $(this).parent().find("input[name=hiddenPerNr]").val();
dataService.findIdpActivities(value);
});
这是 HomeController 中的方法
[HttpPost]
public JsonResult FindIdpActivities(string perNr)
{
viewModel.GetIdpActivities(perNr);
return Json(new
{
Activities = viewModel.IdpActivities
});
}