您正在尝试通过ajax传递数据并获得错误请求错误,请
$scope.getSubCategory = function(id)
{
var category_id=id;
var data = {"CategoryId":"2"};
$.ajax({
url: "http://cashobby.abhigna.info/Services/CashobbyService.svc/subCategory",
type: "POST",
crossDomain : true,
dataType: "json",
data:data,
success: function (data) {
console.log(data);
},
//if wrong otp shoe user a error message
error: function (error) {
console.log(error);
// alert(request.responseText);
}
});
}
任何帮助请尝试传递数据'{"CategoryId":"2"}';
和JSON.strinify
,但没有任何建议
答案 0 :(得分:0)
尝试将contentType
添加到您的ajax正文
contentType: "application/json; charset=utf-8",