title: Why do I need to refresh the page to get the newly-updated data?
body: <p>I was making an application including a comment function with "likes" and "dislikes" just like Facebook. But I find when users click the button of "like" or "dislike", everything goes well --- the database has been updated and the new data has been rendered back to previous webpage, except users need to refresh the page manually to get the new webpage with newly-updated data. Here are my files (I just take the codes of "like" function as example, the codes of "dislike" function is the same):</p>
  
  <p>JS codes:</p>
  
  <pre><code>$("#scrollit").on("click", ".fa-thumbs-up", function(){
  var numberOfLikes = Number($(this).next().html());
  var numberOfDislikes = Number($(this).next().next().next().html());
  numberOfLikes = numberOfLikes + 1;
  var Text = $(this).next().next().next().next().next().html();
  console.log(Text);
  
  $.ajax({
      method: "POST",
      url: "/searchresult/comments/likes",
      data: {text:Text, likes: numberOfLikes, dislikes: numberOfDislikes}
  });
  });
  </code></pre>
  
  <p>Node.js codes:</p>
  
  <pre><code>app.post("/searchresult/comments/likes", function(req, res) {
  var likes = req.body.likes;
  var Text = req.body.text;
  
  new Promise(function(resolve, reject) {
          comments.update({text: Text}, {$set: {likes: likes}}, function(err){
              if (err) {
                  console.log(err);
              } else {
                  console.log("Likes update successfully!");
                  resolve(comments);
              }
          });
  }).then(function(r){
      console.log("DONE!");
      res.redirect("/searchresult");
  });
  });
  
  
  app.get("/searchresult", function(req, res){
  var EnglishofWord = EnglishofWords[EnglishofWords.length - 1];
  grewords.findOne({English: EnglishofWord}).populate("Comments").exec(function(err, allgrewords){
      if (err) {
          console.log(err);
      }   else {
          console.log(allgrewords);
          if (allgrewords == null || allgrewords.length &lt; 1 || allgrewords == undefined ) {
              console.log("We don't have this word in dictionary!");
              res.render("errorpage");
          } else {
              res.render("searchresult", {greword:allgrewords});
          }
      }
  });
  });
  </code></pre>
  
  <p>ejs codes:</p>
  
  <pre><code>&lt;% greword.Comments.forEach(function(comment){ %&gt;
                      &lt;strong&gt;&lt;p class="author"&gt;&lt;%= comment.author %&gt;&lt;/p&gt;&lt;/strong&gt;
                      &lt;i class="far fa-thumbs-up"&gt;&lt;/i&gt;&lt;span class="likes"&gt;&lt;%= comment.likes %&gt;&lt;/span&gt;
                      &lt;i class="far fa-thumbs-down"&gt;&lt;/i&gt;&lt;span class="dislikes"&gt;&lt;%= comment.dislikes%&gt;&lt;/span&gt;
                      &lt;span class="pull-right"&gt;10 days ago&lt;/span&gt;
                      &lt;p&gt;&lt;%= comment.text %&gt;&lt;/p&gt;
                      &lt;% }) %&gt;
  </code></pre>
  
  <p>Could anybody help me to figure it out? ---- Why doesn't the webpage refresh itself automatically? Thanks so much! :P</p>
  
  <p>//************************************************ Update! ***************************************************//</p>
  
  <p>Thanks a lot to t3__rry, his/her suggestion was enlightening! Now I have made it work properly.</p>