I am trying to implement facebook-linke interaction with buttons voting. I have the following code for my reviews page;
% @school_reviews.each do |school_review| %>
<div class="widget-box ">
<div class="widget-header widget-header-small padding-16">
<div class="widget-toolbar no-border">
<span class="vbar"></span>
<span class="vbar"></span>
<small class="theme-color"> <%= school_review.created_at.strftime(" %d-%b %Y ") %> </small>
<span class="vbar"></span>
<span class="vbar"></span>
<% if can? :destroy, school_review %>
<%= link_to(school_review, method: :delete, data: { confirm: 'Are you sure?' }, class: 'red') do %>
<i class="icon-trash bigger-130"></i>
<% end %>
<% end %>
<span class="vbar"></span>
</div>
</div>
<div class="widget-body">
<div class="widget-main padding-16">
<%= simple_format(school_review.description) %>
<div class="">
<span class="review-votes theme-color">
<span id= <%= "up_votes_count-#{school_review.id}" %>> <%= school_review.get_likes.size %> </span>
<span>
<%= link_to vote_up_path(id: school_review.id), remote: true do %>
<i class="fa fa-thumbs-up theme-color "></i>
<% end %>
</span>
</span>
<span class="review-votes theme-color">
<span id= <%= "down_votes_count-#{school_review.id}" %>> <%= school_review.get_dislikes.size %> </span>
<span>
<%= link_to vote_down_path(id: school_review.id), remote: true do %>
<i class="fa fa-thumbs-down theme-color "></i>
<% end %>
</span>
</span>
</div>
</div>
</div>
</div>
<div class="hr hr-12"></div>
<% end %>
and vote_up.js.erb looks like this;
getElementById(<%= "up_votes_count-#{@school_review.id}" %>).html(<%= "@school_review.get_likes.size" %>);
and vote_down.js.erb looks like this;
getElementById(<%= "down_votes_count-#{@school_review.id}"%>).html("<%= @school_review.get_dislikes.size %>");
However the vote counts are not being refreshed. Any help?