Kleber Shimabuku wrote in post #1015666:
> any advice? blog post?
>
This works for me:
<h1>Users#new</h1>
<p>Find me in app/views/users/new.html.erb</p>
<%= link_to "Click me",
{:controller => 'users', :action => 'get_info'},
:remote => true %>
<div id="update_me">Hello</div>
<div>world</div>
===
class UsersController < ApplicationController
def new
@title = "Sign up"
end
def get_info
@data = 'world'
end
end
====
<!DOCTYPE html>
<html>
<head>
<title><%= @title %></title>
<%= csrf_meta_tag %>
<%= javascript_include_tag :defaults %>
</head>
<body>
<%= yield %>
</body>
</html>
===
TestApp::Application.routes.draw do
get "users/get_info"
===app/views/users/get_info.js.erb
$("update_me").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.