I have a post call in my code:
save2 : function ( lotto ) {
var configDistintaIngrediente = {
params: {
distintaBaseGelato_id : 1,
ingrediente_id : 2,
quantitaIngrediente : 4.56,
lottoIngrediente : lotto }
};
return $http.post(urlDistinteIngredienti, "", configDistintaIngrediente)
.success(function(data) {
alert ("OK");
})
.error(function(data, status, headers, config) {
alert (
"data: " + data + "\n" +
"status: " + status + "\n" +
"headers: " + headers + "\n" +
"config: " + config + "\n"
);
});
},
// continue....
I do not why when I call the function, I get this error:
SyntaxError: Unexpected token I
at Object.parse (native)
at fromJson (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js:1065:14)
at defaultHttpResponseTransform (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js:8579:16)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js:8664:12
at forEach (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js:323:20)
at transformData (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js:8663:3)
at transformResponse (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js:9389:23)
at processQueue (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js:13189:27)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js:13205:27
at Scope.$get.Scope.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js:14401:28)
It is very strange because in avery case the operation to insert in my db work fine but there is an error in the post call and in fact I get the alert in:
.error(function(data, status, headers, config) {
alert (
"data: " + data + "\n" +
"status: " + status + "\n" +
"headers: " + headers + "\n" +
"config: " + config + "\n"
);
});
This request works but get me an error...