In my AngularJS service, I am encountering an issue with the following code snippet:
$http.post("/EditWorkout/GetId", data).error(function (responseData) {
console.log("Error !" + responseData);
});
Furthermore, in my ASP.NET controller, I have the following method defined:
[System.Web.Http.HttpPost]
public JsonResult GetId(string routineId)
{
try
{
string x = routineId;
return Json(new {success = true});
}
catch (Exception ex)
{
return Json(new { success = false, errorMessage = ex.Message });
}
}
While debugging, I noticed that when reaching
return Json(new {success = true});
, the breakpoint is hit. However, the value of routineId is unexpectedly null, even though the data sent using Angular's $http.post contains a value.
What could be causing this issue?