I just recently made a voting system that has a vote tallier for each time a user clicks on the vote button for a post and at the same time a counter that tracks the amount of votes the user made. The vote button refresh only that part of the HTML so without the whole page refreshing the vote tally number changes but the counter of vote amounts doesn't change unless the whole page is refreshed. How can I make it so that both with refresh only their part when the vote button is clicked upon? Just not sure where to start. Thank you!
HTML for Vote
<div class='Counter'>
<span class='CounterNum'><span id='<%= micropost.id%>'><%=micropost.votes_for %></span></span>
<div class='<%=micropost.id %>'>
<a href="/microposts/<%=micropost.id %>/vote_up" data-remote='true' class='CounterButton b2'>
<span id="CounterIcon" class="<%=micropost.id%>"></span>
</a>
</div>
</div>
HTML for Vote Amount
<li class='fst'><a class='ProfileLikes' href="/"><%[email protected]_count(:up) %><span class='ProfileStatText'>Likes</span></a></li>
Vote_up.Js
$("#<%[email protected]%>").html('<%="#{@micropost.votes_for}"%>');
$(".<%[email protected]%>").html('<a href="/microposts/<%[email protected]%>/unvote" data-remote="true" class="SquekCounterButton b3 <%[email protected]%>"><span id="SquekCounterIcon" class="<%[email protected]%>"></span></a>');