0

postDataでサーバーにリクエストを送信したい。(JSON)

$http私は次の要求を試みました、

var jsonData = {"id": 1, "名前": "xxx", "役職": "開発者", "部署": "IT"};

$http({method: 'POST',
            url: url,
            data: jsonData,
            headers: {'contentType': 'application/json'}
        }).success(function() {
            $scope.sucess = "Success";
        }).error(function() {
            $scope.errorMessage = "Failure";
        });

$resource('/path/to/the/server',{},{update:{method: 'POST', headers: 
{'Content-Type': 'application/json'}}});

しかし、私は「$http と $resource リクエストの両方で入力エラーが終了したため、オブジェクトにマップするコンテンツがありません。

追加情報: * My client side application is running on Express serve with node.js* 上記の方法のいずれかでこれを達成する方法を教えてもらえますか?

4

0 に答える 0