0
這裏傳遞一個數據表到WCF服務是使用了數據表中要求我的WCF服務:我想用angularjs
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "/checkout",
BodyStyle = WebMessageBodyStyle.Bare,
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json)]
void Checkout(UserDetails data);
這是我的客戶端代碼:
$scope.checkout = function() {
var data = {
"MemberID": "2500394300",
"CategoryID": "1",
"ProductID": "1",
"PointValue": "100"
};
$http.post(
"url",
data,
{
headers: {
'Content-Type': 'application/json'
}
}
).success(function (result) {
alert(result);
});
}
您應該使用json數據以方便使用。 – Chandermani