I get the message Uncaught TypeError:Undefined is not a function
when I try to call a the method in my home controller.
Advice perhaps as to why I am getting this message?
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);
}
});
};
executing the method upon button click.
$(document).on("click", "input[name=btnViewActivities]", function (e) {
e.preventDefault();
var value = $(this).parent().find("input[name=hiddenPerNr]").val();
dataService.findIdpActivities(value);
});
and this is the method in the HomeController
[HttpPost]
public JsonResult FindIdpActivities(string perNr)
{
viewModel.GetIdpActivities(perNr);
return Json(new
{
Activities = viewModel.IdpActivities
});
}