3
I’m making a post request for a php file that requires some data that is sent by the request. My question is how to retrieve this information that is being sent in the request
My requisition code is like this:
//pego a descricao no compa input
var dados = {"descricao": $('#descricao').val()};
$scope.getData = function() {
$http.post('data.php', dados).success(function(data) {
...
console.log(data);
}).error(function(data) {
...
console.log(data);
});
How would you get this information in the data.php file'?
var_dump($_POST);
returns an empty array: array(0) { }
@Sergio, I found a solution. I did so: $data = file_get_contents("php://input");
– Meeeefiu