title: Changing content inside html with nodejs without rendering page
body: <p>Just learning nodejs. I want to change content inside my html without completely rendering in the page when I post. </p>
  
  <p>Here is my current code.</p>
  
  <pre><code>app.use(express.static('public'));
  app.use(bodyParser.urlencoded({ extended: true }));
  app.set('view engine', 'ejs')
  var arr = [];
  
  app.get('/', function (req, res) {
    res.render('index', {messages: null, error: null});
  })
  
  app.post('/user', function (req, res) {
          var input = req.body.userInput;
          var output = "";
          arr.push(input);
          for(var i = 0; i &lt; arr.length;i++){
              (function(){
                  console.log(arr[i]);
                  output +=arr[i] + "&lt;/br&gt;";
              })(i);
        }
        res.render('index', {messages: output, error: null});  
  })
  
  
  app.listen(port, function () {
    console.log('Example app listening on port 3000!')
  })
  </code></pre>
  
  <p>Thanks. Any advice is really appreciated.</p>