Search code examples
node.jsmongodbmongooseejs

I want to pass the passed value of ejs back to my nodejs server


Here I am console.log() these values on app.js getting value from my page.ejs file, all the console.log() is working except req.body.name.

Here is the ss of page.ejs file. I am not able to get how to send back the value of <%= name %> back of my nodejs server. I have tried using the button and span tag but did not get the result.


Solution

  • You just need to add value attribute in your button and change its name.

    <button name="name" value="<%= name %>"><%= name %></button>