Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7548743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:46:34+00:00 2026-05-30T09:46:34+00:00

I came across this link the other day and I decided to implement this

  • 0

I came across this link the other day and I decided to implement this voting system through ajax: JQuery + thumbs_up gem render vote count? . But the problem is I pretty much followed it step by step but it seems as though the ajax isn’t working. Can anyone help? Thank you!

Micropost Controller

class MicropostsController < ApplicationController

  def vote_up
    @micropost = Micropost.find(params[:id])
    current_user.vote_exclusively_for(@micropost)
  end

  def vote_down
    @micropost = Micropost.find(params[:id])
    current_user.vote_exclusively_against(@micropost)
  end

end

votecount.html.erb

<div class='Counter'>
<span class='CounterNum'><%= @micropost.votes_for %></span>
<a href="#" class='CounterButton b2' updown="up" theid="123">
<span class='CounterIcon'></span>
</a>
<a href="#" class='CounterButton b2' updown="down" theid="123">
<span class='CounterIcon'></span>
</a>
</div>

votecount.js

$(document).ready(function(){
    $(".CounterButton").click(function() {
        var val = $(this).attr('updown');
        var theid = $(this).attr('theid');
        if (val == "up") {
            console.log('up');
        } else {
            console.log('down');
        }
    });​
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:46:35+00:00Added an answer on May 30, 2026 at 9:46 am

    It is working fine for me .. Just have look at this http://jsfiddle.net/GLVQe/

    Make sure you added jQuery library file before this jQuery code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was going through this link , where I came across a point Avoid
I came across this link flying twitter bird , was just wondering , how
I came across this link http://www.mathopenref.com/coordpolygonarea2.html It explains how to calculate the area of
The other day I came across an alternative way of accessing web.config configuration in
I came across this link: http://ofps.oreilly.com/titles/9780596805784/ which seems to suggest web app can be
I came across this link today that offers a ToolStripProfessionalRenderer implementation for the Office
Came across this error today. Wondering if anyone can tell me what it means:
I came across this article written by Andrei Alexandrescu and Petru Marginean many years
I came across this recently, up until now I have been happily overriding the
I came across this class while reading a C# book and have some questions.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.