使用方法POST时收到此错误。请帮帮我。
angular_min.js:114 SyntaxError: Unexpected token { in JSON at position 71
at JSON.parse (<anonymous>)
at wc (angular_min.js:16)
at cc (angular_min.js:88)
at angular_min.js:89
at n (angular_min.js:7)
at hd (angular_min.js:89)
at c (angular_min.js:91)
at angular_min.js:126
at m.$eval (angular_min.js:141)
at m.$digest (angular_min.js:138)
我的代码: var json = {PARAMETER_NAME:&#34;量&#34;&#34; PARAMETER_VALUE&#34;:$ scope.it.amount};
var arr=[];
arr.push(json);
$scope.object={formula:$scope.it.formula_saving_point};
$scope.companyTemp={company_id:com_id};
var url = API_URL + "cumulative_point_formula";
var cmd = "check_formula";
var jsonFinal = JSON.stringify({json_parameter: JSON.parse(JSON.stringify(arr)),
company: JSON.parse(JSON.stringify($scope.companyTemp)),
cumulative_point_formula: JSON.parse(JSON.stringify($scope.object))});
此日志 jsonFinal
{"json_parameter":[{"parameter_name":"amount","parameter_value":"111111111"}],"company":{"company_id":40743},"cumulative_point_formula":{"formula":"amount/10000"}}
这是方法POST:
$http({
method: 'POST',
url: url,
data: $.param({cm: cmd, dt: jsonFinal}),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).success(function (response) {
console.log("success");
});
如何修复此错误?
答案 0 :(得分:0)