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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:06:33+00:00 2026-05-21T09:06:33+00:00

I have a controller: class QuestionsController < ApplicationController def hello puts ====================!!!=================== @hello =

  • 0

I have a controller:

class QuestionsController < ApplicationController
  def hello
    puts "====================!!!==================="
    @hello = "hey"
    "some"
  end

  def test
  end

test.rhtml:

<%= javascript_include_tag :defaults %>

<br/>
Click this link to show the current 
<br/>

<%= link_to "hello", 
    { :controller => "questions", :action => "hello" },
    :update => 'time_div', 
    :remote => true %>.

<br/>
<div id='time_div'>
  ...
</div>

When I click on ‘hello’ link I see that hello() method was called, but html page remains the same. Why?

How do I need to change code to update HTML page?

Here is generated HTML page:

<!DOCTYPE html>
<html>
<head>
  <title>Stack</title>


  <script src="/javascripts/jquery.js?1286229922" type="text/javascript"></script>
<script src="/javascripts/jquery-ujs.js?1286229922" type="text/javascript"></script>
  <meta name="csrf-param" content="authenticity_token"/>
<meta name="csrf-token" content="UKPX1dNCZhyTk8u71hR9KaUmufIire7Rhvg8t7cRSlM="/>

</head>

<body>



<br/>
Click this link to show the current 
<br/>

<a href="/questions/hello" data-remote="true">hello</a>
<br/>

<div id='time_div'>
  ...
</div>



</body>
</html>
  • 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-21T09:06:34+00:00Added an answer on May 21, 2026 at 9:06 am

    You can have your hello action like this:

    def hello
      #### your code goes here #####
      respond_to do |format|
        format.js { render :layout=>false }
      end
    end
    

    And one file hello.js.erb

    $("#time_div").html("some text");
    

    And your link will be:

    <%= link_to "hello", { :controller => "questions", :action => "hello" }, :remote => true %>.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have controller: class AccountController < ApplicationController def index end private def current_account @current_account
I have a controller class PageController < ApplicationController def home print Custom + params
I have a controller: class StatsController < ApplicationController require 'time' def index @started =
I have a controller class class MyController < ApplicationController def firstMethod @obj = #get
I have a controller which has a method called history class UsersController < ApplicationController
I have a controller with a action similar to this class EventsController < ApplicationController
I have a controller class that uses asynchronous calls to perform some network operations.
I have the following controller: class MyController { def simple = { render simple
I have this controller: class SchedulesController post, :except => :index def index #Schedules.create(:id =>
I have a controller class as in the following code segment: @Controller public class

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.