Reputation: 885
I am sending a data along with $http.get request like below to node server.
$http.get("/deletebookData",{pathsrc : "a"}).success(function (result) {});
on node js i am not able to receive the {pathsrc : "a"} sent in get request.
app.get("/deletebookData", function (req, response) {
console.log(req.body);
});
only empty json is printed in console
Upvotes: 0
Views: 234
Reputation: 3722
You are not sending the data. Check the $http.get
documentation.
If you want to include params in your request use:
$http({
url: '/deletebookData',
method: 'GET'
params: {pathsrc : "a"}
})
.then(function(){..});
Or:
$http.get('/deletebookData',{params: {pathsrc :'a'}}).then(function(){..});
Or build your url manualy:
$http.get("/deletebookData?pathsrc=a").then(function(){..})
(Also, please note that since angular 1.4 .success()
is deprecated. Use .then()
instead)
Upvotes: 1