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

The Archive Base Latest Questions

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

I am using link_to :remote to update one of the div elements on the

  • 0

I am using link_to :remote to update one of the div elements on the HTML. This is just a beginner’s code. However, the update does not occur on clicking the link. Here is the code:

class SampleController < ApplicationController
     def updater
        render :text => Time.now
     end
end

this is the list.html.erb:

<script type = "text/javascript" src = "/javascripts/prototype.js">
<%= link_to "Hello Testing",
    :update => "test_id",
    :url => {:action => 'updater'},
    :remote => true
%>
<div id="test_id"></div>

So on click the link “Hello Testing”, the URL in the browser changes to:
http://localhost:3000/samples?remote=true&update=response_id&url[action]=updater

However, the div element that I am trying to set to the current time does not occur on the UI. What can be the issue here?


Updated the post with:

routes.rb: http://pastebin.com/wmKsa1DD
Generated HTML Code : http://pastebin.com/stU3FpL8
HTML Response in Firebug: http://pastebin.com/WjsB7zAh

Using url_for does not change the behaviour.

  • 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:29:14+00:00Added an answer on May 21, 2026 at 9:29 am

    1: You should include also rails.js file. Ordinary in Rails it makes like this:

    <%= javascript_include_tag :defaults %>
    

    2: I prefer to use this naming for urls: updater_samples_path or [:updater, :samples]

    3: You should show your routes. If updater method using not GET method, then you should define it:

    <%= link_to "Hello Testing", :update => "test_id", updater_samples_path, :method => :put, :remote => true %>
    

    4: Use FIREBUG to se your AJAX responses. So you can easily debug your app. Also you can show us its response, so we will better understend situation

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

Sidebar

Related Questions

UPDATE: This is the CFC code that I'm using to retrieve the data. I'm
I need to insert/update data by using link or image I need a code
I have a code that looks like this. <%= link_to_remote View results, { :update=>uxUpdateDiv
I am using this code to download video from you tube (it is a
I m using Rails 3.2.1 . how to use link_to with remote=>true My Method
I have html source code which I want to filter out one or more
Update: This turned into a blog post, with updated links and code, over at
I have this link: <div id='up_arrow_div'> <%= link_to &uArr;.html_safe, video_votes_path( :video_id => video.id, :type
I'm trying to do a simple AJAX request using link_to :remote option and display
I'm using this approach to display an icon near each link to a file

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.