Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.controller('MyLogin', function($scope, $http) {
- $scope.form = {username : '', password : ''};
- $scope.submit = function () {
- $http({
- url: '/login',
- method: 'POST',
- headers:{
- 'Content-Type' : 'application/x-www-form-urlencoded'
- },
- data: {
- 'username' : $scope.form.username,
- 'password' : $scope.form.password
- },
- }).then(function (response) {
- console.log(response.data);
- });
- }
- class LoginController extends AbstractRestfulController {
- public function indexAction() {
- $data = file_get_contents("php://input");
- $request = json_decode($data);
- var_dump($request);
- var_dump($request->username); }}
- object(stdClass)#194 (2) {
- ["username"]=>
- string(7) "yassine"
- ["password"]=>
- string(7) "yassine"
- }
- string(7) "yassine"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement