currently i have an api in which you send a json and the api response:
the json i send: {
"instructions": [
{
"A": 9,
"B": 1,
"move": "moveonto"
},
{
"A": 8,
"B": 1,
"move": "moveover"
}
],
"length": 20,
"res": "null"
}
and the api response: {
"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 developing a very basic webpage:
when i click on the send to the server button i need to send it, the problem is i dont know how to build the json, can you help me? thx
i have slight idea:
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
};
and i send it :
$http.post("http://localhost:56493/api/BlocksProblem", Json)
.then(function (data) {
$scope.result = data;
}, function (response) {
$scope.result = response;
});
thank you very much for your time reading through all of it.