1

I try to post data from angularJS to my web-Service and want to get data back.

The post-request works great, I get data back (which I hardcoded in PHP), but (after 2h searching) my problem is that I cant send some Post-Data.

Here my code:

   angular.module('LunchApp', [])
  .controller('MessagesCtrl', function($scope, $http){
        $http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded";
        var postData = { callMethod: 'getChat' };
        $http.post(url, postData).success(function(data){
            $scope.messages = data;
        });
  });

I have tried many solutions:

but nothing works for me... :(

If I try it with a RESTful TestClient, it works perfectly. all posted data reach the server. But not with AngularJS :(

Community
  • 1
  • 1
Marco Rehmer
  • 1,033
  • 2
  • 12
  • 32

0 Answers0