I'm trying to send a POST
via angular, just like I did in JQuery
, however, when trying to capture the data via $_POST
variable, it's not bringing any value.
I'm running a code similar to this in angular :
$http.post('/users/ajax-create', user).then(...);
The angle appears to be sending the data without the formatting required for PHP to process the parameters for the $_POST
variable.
I can only get the values if I do this:
json_decode(file_get_contents('php://input'), true);
But the above behavior is not desired. I would like to use angularjs in my php application, however I would not like to rewrite it or start doing different things just because of that angular
Is there any way to send the data of a javascript object by angular , but as parameters of a form form-url-encoded
?
Note: If this is a standard angular behavior, I would not want to be writing any code to each project that I implemented the angle. So if there is any library ready to convert the data to form-url-encoded
, I'll be happy if there is an indication.