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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:42:23+00:00 2026-06-11T11:42:23+00:00

In an ERB Rails view <%= link_to(Destroy, foos_path(1), :method => :delete, :confirm => Are

  • 0

In an ERB Rails view

<%= link_to("Destroy", foos_path(1), :method => :delete, :confirm => "Are you sure?") %>

With a link_to like the above you can process the delete for a foo with an ID of 1.
How do make it remote and (a) still control being redirected to a page of my control or (b) call custom JavaScript (the goal of which would be jQuery to refresh a list)

  • 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-06-11T11:42:24+00:00Added an answer on June 11, 2026 at 11:42 am

    Add :remote => true to the link_to will create a remote link.

    In your controller method at the end put

    respond_to do |format|
      format.js { render "my_method"}
    end
    

    You can omit the name of the ajax file if it’s the same name as the method.

    In my_method.js.erb simply call javascript functions, and you can embed erb ie:

    $("#someDiv").load(<%= @some_value $>);
    

    You can redirect to another page using standard javascript/jquery if you choose.

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

Sidebar

Related Questions

In my rails view(index.html.erb), i have following structure <div> <%= render :partial => create
(Warning: Clueless Rails Newbie!) In my show.html.erb for my albums view, I call a
I have a nested form in a rails view that is called like this
I m using Rails 3.2.1 . how to use link_to with remote=>true My Method
In a Rails (erb) view, I want to conditionaly display some text and a
I am attempting to parse, not evaluate, rails ERB files in a Hpricot/Nokogiri type
it seems that on Rails or erb, the only way to output anything is
Experiencing jquery in rails through .js.erb templates; but completely puzzled by a simple problem
In Rails, I want to run the js.erb file associated with an action on
I am using rails beta 3 and I have a erb page named index.html.erb

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.