简体   繁体   中英

Can't access POST parameters dynamically in node.js

I have the a datatable send the parameters

When i retrieve req.body for my post i have the full result

app.post('/folder/service', (req, res)=>{
    res.setHeader("Access-Control-Allow-Origin", "*");

    let response;

    response = req.body;

    res.send(response);
});

result

action: edit
data[CODE]: 1
data[DESCRIPTION]: TEST

req.body["data[DESCRIPTION]"] works too

but i trying get the parameters dinamically

Ps: i saw the way to retrieve the parameters in get using req.param("data") but don't work on post

You should use req.body.[property name] . For example: req.body.description

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM