Ruby on Rails Wednesday, February 29, 2012

I m using Rails 3.2.1. how to use link_to with remote=>true

--------------------------------------------
My Method in Controller

def clickme
@clk = "you click me"
respond_to do |format|
format.js { render :layout=>false }
end
end
--------------------------------------------
My View
In my new.html.erb file

<%= link_to "click here", {:action=>"clickme"}, {:remote => true,
:id=>"clk"} %>

<div id="allclick">
<%= render :partial => 'goclick' %>
</div>

--------------------------------------------
_goclick.html.erb

<%= @clk %>

--------------------------------------------
clickme.js.erb

$("allclick").update("<%= escape_javascript(render(:partial =>
"goclick")) %>");
--------------------------------------------
On my web-page everything is fine when I click on click here link
nothing change. But when I check Firebug console it shows me:

$("allclick").update("you click me");

--------------------------------------------
Help Me :(

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment