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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:08:37+00:00 2026-05-30T02:08:37+00:00

In rails 3.1, I implement as: 1. Define test action in post controller: def

  • 0

In rails 3.1, I implement as:
1. Define test action in post controller:

def test
    @p = Post.first
    respond_to do |format|
      format.js
    end
end

2. Define in routes.rb:

resources :posts do
  collection do
    get 'test'
  end
end

3. In index.html.erb of post folder, I add link:

<%= link_to "test", test_post_path, :remote => true %>

4. Create test.js.erb file in post folder:

code jQuery

My question is: “Is my implement Ajax in rails 3.1?” I don’t really understand about ajax in rails.
If no, can you give me a link about ajax in rails 3.1 and the technique I set up, what is it?

  • 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-30T02:08:38+00:00Added an answer on May 30, 2026 at 2:08 am

    Yes it is ajax. When you add :remote => true to links and forms in rails, it automatically sends data to the server without refreshing your page on the browser. That’s how ajax works in every language/script.

    In your case, you can put js code in your test.js.erb file to update/interact the page (with jQuery). You might want to update some html div elements with the attributes of instance variable you set up @p .

    Eg. in your test.js.erb

    $("#some_div").html("<%= @p.title%>");
    

    Then you have essentially made an ajax request to the server and update the client browser page with the server data without refreshing.

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

Sidebar

Related Questions

Basically I want to implement a simple Rails extension to define the seriousness of
I'm looking to implement content negotiation on some resources in a Rails app. I'm
Missing my Rails map.resources and wondering how I can implement something similar in ASP.NET
I'd like to implement a scalable chatroom in rails using AJAX. I know from
I need to implement a web client in a Rails app. The existing web
I am trying to implement a bulk update feature in a Rails app, the
I need to implement fine-grained access control in a Ruby on Rails app. The
I'm trying to implement thinking-sphinx across multiple 'sites' hosted under a single rails application.
Goal: To implement a jQuery plugin for my rails app (or write one myself,
I'm following a Rails cast to implement subscription billing. It's here: http://railscasts.com/episodes/288-billing-with-stripe My code

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.