You can make your js more general by doing this:
<h1>Users#new</h1>
<p>Find me in app/views/users/new.html.erb</p>
<%= link_to "Click me",
{:controller => 'users',
:action => 'get_info',
:my_target => 'update_me'},
:remote => true %>
<div id="update_me">Hello</div>
<div>world</div>
===
class UsersController < ApplicationController
def new
@title = "Sign up"
end
def get_info
@target = params[:my_target]
@data = 'world'
end
end
==app/views/users/get_info.js.erb
$("<%= @target %>").update("<%= @data %>");
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.