這裏是我的AngularJS控制器代碼從我發送HTTP POST請求到服務器:
'use strict';
var input = {title: "", note:""};
notes.controller('inputController', function inputController($scope, $http) {
$scope.cancleInput = function() {
//not yet implemented
}
$scope.saveInput = function() {
input.title = $scope.title;
input.note = $scope.note;
$http.post("/saveData/writeData", input);
}
})
這裏是我的代碼C#控制器內:
public class saveDataController : Controller
{
public static void writeData(input input)
{
var jsonString = new JavaScriptSerializer().Serialize(input);
//other code
}
}
的HTTP POST調用不能識別C#方法。 我很確定我的網址錯了,或者我缺少任何C#屬性。
我收到以下錯誤: POST http://localhost:56171/saveData/writeData 500(內部服務器錯誤)
C#的方法不打那麼它永遠不會被髮布請求被稱爲破發點。
這JS錯誤你得到?在這裏給你的角度js控制器聲明代碼。 – ranakrunal9
@ ranakrunal9我將信息添加到您要求的帖子中。 –