I am trying to sent content with an xmlHttpRequest from the client-side, but I am not able to receive those parameters on server-side.
Setting parameters on the server-side an retrieving them client-side works fine, but when I try to get on the server-side, the parameters which I am trying to set on the client side I always get an empty value / undefined.
node.js server side response on req.params =
...
( params: [] } )
...
any ideas why it isn't retrieving the parameters on the server-side? On server side I am using a app.post('/delete', function(req, res){ ..) where I try to console.log the req.params which should be set with the following client-side code (but doesn't) :
https://jsfiddle.net/user979979/ea2w1sn8/
Thank you!
You need to use BodyParser middleware on server side.
In your app.js, import bodyparser
import bodyParser from 'body-parser';
then write
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
Now you will get your post parameters in req.body and get parameters in req.query