How to send the response to the same html page after clicking submit button using node.js
<p>Onclick of submit button,I'm redirecting the data "name" to this url <a href="http://localhost:3000/getfileNames.But" rel="nofollow">http://localhost:3000/getfileNames.But</a>, now I'm trying to get the data "name" to same html page(<a href="http://localhost:3000/login).Can" rel="nofollow">http://localhost:3000/login).Can</a> anyone please help me out regarding this ...</p>

<p>My sample.html:</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;h1&gt;
Login
&lt;/h1&gt;

&lt;/head&gt;
&lt;body&gt;
    &lt;div id="formContainer"&gt;
        &lt;form method="post" action="/getfileNames"&gt;
             Name: &lt;input type="text" name="name" id="name" placeholder="name"&gt; &lt;br&gt;&lt;br&gt;
             Password: &lt;input type="text" name="pwd" id="pwd" placeholder="password"&gt; &lt;br&gt;&lt;br&gt;
            &lt;input type="submit" name="submit" value="submit" /&gt;
        &lt;/form&gt;
    &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>My index.js:</p>

<pre><code>var express = require('express');
var router = express.Router();


router.get("/login", function(req, res)
{

    res.sendFile("login.html", {"root": __dirname});

});


router.post('/getfileNames', function(req, res) {
    console.log(req.body.name);
    res.send('Name: ' + req.body.name);
});




module.exports = router;
</code></pre>