I use node.js – Express. I have a page (index.html) and html div (id = box) and input (id = inputUser). I want to express through insert (when the page loads) text into the div and input.
Thanks for the advice!
Client:
<form method="post" action="/">
<input type="text" name="inputUser" id="inputUser" />
<div id="box"></div>
</form>
Server:
app.get('/', function (req, res) {
res.render('index.html', { layout: false });
});
app.post('/', function(req, res){
});
From what I see in your code snippet above, you are probably using EJS as the view engine. You can pass the variables to the view just like you pass the false option for layout.
Server
Client-side
From the EJS documentation: