javascript - HTTP post from angularjs controller to Nodejs -


this angular controller code

clientapp.controller('formctrl',function($scope,$http){     $scope.statuses = ["active", "inactive"];     $scope.cluster = ["east coast","west coast","paypal"]     //when submit button clicked      $scope.submit = function() {            alert("submit clicked");            $http.post('/clientpost', $scope.formdata).success(function(response) {                 console.log('data posted successfully');             })                      .error(function(data){                             console.log('error: ' + data);                     });     }; }); 

this code takes set of values frontend form in $scope.formdata , trying pass on backend nodejs file using $http.post..

node js - server side controller

app.post('/clientpost', function(req, res) { alert("posted successfully"); var cope = req.body.params; var query = "insert lv_billing.client (client_id, client_name, status, updt_time, updt_by, updt_id, cluster) values ?" alert(cope);  }); 

however, m unable connect nodejs


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -