This should work: console.log('value of POST parameter surname: '+req.body[dynamicName]);
. By doing a dot notation, you are referring to dynamicName
property, not the value it holds as a variable.
0
solved JavaScript: dynamic name of POST parameter