I am trying to send some data from my AngularJS Project to a PHP Server where I am using PHP Slim but I have tried everything I know and nothing seems to work.
SERVER PHP SLIM
$app->get('/create',function() use ($app) {
$data = $app->request()->params();
response_json(200,"DB: User Created",$data);
});
It works if I type directly from the browser
http://localhost:8888/core/users/create?login=test&password=123&name=Test&email=test@test.com&phone=12313
But if I try to send from the app using $http or $resource
var obj = { name:"Hello",email:"hello@email.com"};
$http.get('/core/users/create?',obj).success(function(data){console.log(data); });
I get an empty Array[0].
And if I try to use $resource I got an obj but not how I expected.
.factory('qServer',function($resource){
return $resource('/core/users/create?:data',{data: '@data'});
});
var obj = { name:"Hello",email:"hello@email.com"};
var send = JSON.stringify(obj);
//console.log(lol);
qServer.get({data:send},function(data) { console.log(data) });
With this code I get an Object like that:
data: Object
{"name":"Hello","email":"hello@email_com"}: ""
Anyone could tell me what I am doing wrong?