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 6732993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:42:58+00:00 2026-05-26T10:42:58+00:00

Rails newbie here. I’m looking to learn a little bit about jQuery so I

  • 0

Rails newbie here. I’m looking to learn a little bit about jQuery so I figured I’d try to switch between my views using AJAX. I’m really looking forward to insights in how to do this!

Right now on my user’s dash I have a link to their ‘likes’ page, it requires a full reload to see the ‘show_likes’ views, how would I refresh the div id=”content” with the new view ‘show_likes’ ??

Thanks!

views/pages/home.html.erb

  <div id="left">
    <div id="dash-statistics">
       <a href="<%= likes_user_path(@user) %>">
         <div id="likes" class="stat">Likes
           <%= @user.likes.count %>
         </div>
       </a>
    </div>
  </div>

  <div id="right">
    <div id="content">
    </div>
  </div>

UsersController

def home
    @title = "Home"

    if user_signed_in?
      @user = current_user
      @post = current_user.posts.build
      @collections = @user.posts.map(&:collections).flatten.uniq
      @recommended_posts_count = @user.posts.where(:is_recommended => true).count 
      @feed_items = @user.feed.paginate(:per_page => "10", :page => params[:page]) 
   end
  end

  def likes
    @title = "Likes"
    @user = User.find(params[:id])
    @like_stuff = @user.likes.paginate(:page => params[:page])
    render 'show_likes' 
  end
  • 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-26T10:42:59+00:00Added an answer on May 26, 2026 at 10:42 am

    There are a few options.

    The UJS way would be to have a link_to with a :remote => true. See this post for some details.

    This blog post goes in to more details, but is a bit heavy, and discusses one particular implementation that may or may not be to your liking.

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

Sidebar

Related Questions

Bit of a Rails newbie here so please bear with me. I am trying
Rails newbie here. Can anyone please explain the difference to me between the following
I'm still a rails newbie, and am looking to learn how to write a
Rails newbie here, trying to get a new controller working. When I try to
Rails 3 newbie here.... I'm looking to build an application that limits a user's
Rails newbie here struggling with a small project. I am creating a simple ship
A bit of a newbie question on rails associations. I have a Bug model,
I am a newbie at Javascript, JQuery, and to a lesser extent, Rails. I
Rails newbie here so just want to be sure I'm doing this right. I
Rails newbie here. I have a list of items which can have a status

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.