I am using AngularJS to send a $http.post
request
this is my AngularJS code:
var app = angular.module('myApp', [],function($httpProvider)
{
$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
});
app.controller('notificationsCtrl', function($scope, $http) {
$http.get("listAllNotifications.php")
.then(function (response) {$scope.notifications = response.data.records;});
$scope.removeRow = function (row)
{
var parameter = JSON.stringify({'actions': row});
$res = $http.post("../api/notifications.php",parameter)
.then(function (response) {$scope.notifications = response.data.records;});
}
});
this is the PHP server side codes that receives it :
<?php
print_r($_POST,TRUE);
and this is the print result:
{"actions":1450591689}=""
What am I doing wrong in order to get it as key=>value
in the $_POST
thanks