I get a $.get error calling my WebAPI Controller. The data sent by the $.get still gets to the Controller's method and sends back the data but I get no return value. Exactly the same WebAPI controller works in an MVC 6 project.
HTML Page:
function GetById() { var key = $("#KeyList").data("kendoDropDownList").value(); $.get("/api/todo/id", { key: key }, function (data) { $("#KeyLabel").html(data.Name); }) .error(alert("error")); }
Controller:
[HttpGet("{id}",Name="GetTodo")]publicActionResultGetById(string key){var item =TodoItems.Find(key);if(item ==null){returnHttpNotFound();}returnnewObjectResult(item);}