I am using AngularJS. I would like to send multiple data in a HTTP post through AngularJS. The backend runs Cakephp and I have verified that the Rest API works through python HTTP-post.
I have this controller that looks something like this;
angular.module('myApp.controllers', []).
controller('AlertDemoCtrl', ['$http', function($http)
{
var post_url;
var post_data;
post_url="http://127.0.0.1/api_XXX/";
post_data = {'data[Table1][field1]':'XX',
'data[Table2][0][field1]':'AA',
'data[Table2][0][field2]':'BB',
'data[Table2][0][field3]':'CC'
};
$http.post(post_url, post_data);
}])
When I run the code, the page fails to load AngularJS properly. If I comment away $http.post(post_url, post_data);
, the code runs normally. Where did I go wrong?
Thank you very much.