目前我已經在你發送一個JSON和API響應的API: 的JSON我送:{ "instructions": [ { "A": 9, "B": 1, "move": "moveonto" }, { "A": 8, "B": 1, "move": "moveover" } ], "length": 20, "res": "null" }
建築JSON字符串的形式
和API響應:{ "instructions": [ { "A": 9, "B": 1, "move": "moveonto" }, { "A": 8, "B": 1, "move": "moveover" } ], "length": 20, "res": "Position [0] : 0Position [1] : 1 9 8Position [2] : 2Position [3] : 3Position [4] : 4Position [5] : 5Position [6] : 6Position [7] : 7Position [8] : Position [9] : Position [10] : 10Position [11] : 11Position [12] : 12Position [13] : 13Position [14] : 14Position [15] : 15Position [16] : 16Position [17] : 17Position [18] : 18Position [19] : 19" }
IM發展非常基本的網頁: 當我點擊發送到服務器按鈕我需要發送它,問題是我不知道如何建立json,你能幫我嗎? THX
我有輕微的想法:
Json = {
"instructions": [{
"A": $scope.addA,
"B": $scope.addB,
"move": $scope.addMov
}, {
"A": $scope.addA,
"B": $scope.addB,
"move": $scope.addMov
}],
"length": $scope.blockLength,
"res": null
};
,我把它:
$http.post("http://localhost:56493/api/BlocksProblem", Json)
.then(function (data) {
$scope.result = data;
}, function (response) {
$scope.result = response;
});
非常感謝你爲你的時間,通過它的所有閱讀。
你會得到任何錯誤? – Coder