I have an angular app where I setup the following json object:
var newUser = {
username: $scope.form.username,
password: $scope.form.password,
userTypeId: 1,
email: $scope.form.email
};
I then attempted to post to my php backend:
$http.post(
ENVIRONMENT.backendUrl + '/users/add/.json?XDEBUG_SESSION_START=PHPSTORM',
newUser
).success(function() {
alert("success");
}).error(function() {
alert("failure");
});
Oddly enough, none of the variables were there in the $_POST
array, nor in the php://input
. But when I changed the post to use jquery instead, it work:
$.post(
ENVIRONMENT.backendUrl + '/users/add/.json?XDEBUG_SESSION_START=PHPSTORM',
newUser
).success(function() {
alert( "success");
}).error(function() {
alert( "failure");
});
Any idea on why these two ways of posting cause a difference in the $_POST value?