我想發佈的模式形式的用戶打通過HTTP.POST方法發送的數據,但我很難找出如何實際訪問我已經發布的post函數中的數據對象,或者如果我甚至發送它正確。任何幫助是極大的讚賞
http.post index.html中:
var ModalInstanceCtrl = function($scope, $uibModalInstance, $http, data) {
$scope.data = data;
$scope.ok = function() {
$http.post("http://127.0.0.1:8081/process_post")
.then(function (response) {$scope.data = response.data;});
$uibModalInstance.close();
};
$scope.cancel = function() {
$uibModalInstance.dismiss('cancel');
};
};
過程後功能app.js:
app.post('/process_post', urlencodedParser, function (req, res) {
// Prepare output in JSON format
//response = req;
//console.log(req.body.data);
//res.end(JSON.stringify(response));
})
那是nodeJS嗎? – codemax
我在帖子功能中看不到任何數據。 –
是的,它是節點 –