Like button, add and subtract on database. nodejs, mongodb, mongoose, jquery
<p>I am building a website that user can like, the like button is working, it is storing the likes on the database.
My question is, how can i make the user that when they click the like button again, it will subtract on the database.
I have an animation of like button, 1st default state is it is grey, then when the user click it, it will turn to blue and a "liked" text will appear besides it. then when the user clicks again, it will go back to black.</p>

<p>Here's my code on POST route (because i am adding data to database)</p>

<pre><code>app.post("/index/:id", function(req,res){
    TestData.findById(req.params.id, function(err, theUser){
        if(err){
            console.log(err);
        } else {
            theUser.likes += 1;
            theUser.save();
            console.log(theUser.likes);
        }
    });
});
</code></pre>

<p>my EJS file:</p>

<pre><code>      &lt;a class="likeicon" href="/index/&lt;%= newUsers._id %&gt;?_method=POST"&gt;
       &lt;i class="fa fa-thumbs-o-up" aria-hidden="true" &gt;&lt;/i&gt;
      &lt;/a&gt;
</code></pre>

<p>and my jQuery:</p>

<pre><code>$(".likeicon").on('click', function(){
if($(this).css("color") === "rgb(0, 0, 255)"){
  $("#likedtxt").remove();
  $(this).css("color", "black");
  $(this).animate({fontSize: "15px"});


} else {
  $(this).css("color", "blue");
  $(this).append("&lt;span id='likedtxt'&gt;Liked&lt;/span&gt;");
  $(this).animate({fontSize: "18px"});
}  
});
</code></pre>

<p>also another question, when i click liked, it is adding to the database, but how can i show it LIVE on the user screen that the count on likes are updated? without reloading the screen. because i dont want to use res.redirect, it refreshes the webpage. </p>