我正在使用角度js和Web服务(asmx)编码连接到数据库。 我写了下面的代码CONTROLER:SyntaxError:意外的标记{在位置6567处的JSON中
var parameter = { "CartID": CartID, "Quantity": Quantity, "CostCode": costcode, "DebitTo": debitto, "ItemPriceID": ItemPriceid, "TotalPrice": TotalPrice, "LocationCode": location };
alert(JSON.stringify(parameter));
$http({
method: 'post',
data: parameter,
url: 'wfrmOrderPlacement.asmx/AddItemsToCart',
}).then(function (response) {
//Some methods here.........
}
它的工作很好..
但是同样我也有使用其他HTTP调用访问的另一种方法在ASMX象下面这样:
var parameter = { "SelectedLocationcode": location };
alert(JSON.stringify(parameter));
$http({
method: 'post',
data:parameter,
url: 'wfrmOrderPlacement.asmx/GetItemDetails',
}).then(function (response) {
$scope.items = response.data;
});
但这是给出了提到的错误:SyntaxError:意外的标记{在位置6567的JSON
它工作正常,当我删除我的p数据参数:那我传递到Web方法arameters
嗨,尝试删除逗号(,)后url – M3ghana
@ M3ghana我已经尝试删除逗号,它没有用;仍然是同样的问题.... –
你可以粘贴var参数前面的行吗? – M3ghana