--------------------------------------------
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/.
I'm using $("#allclick").update
wrong way :
$("#allclick").update("<%= escape_javascript(render(:partial =>
"goclick")) %>");
====================================================================
correct way :
$("#allclick").html("<%= escape_javascript(render(:partial =>
"goclick")) %>");
====================================================================
Instead of update now I'm using html
Update would work perfectly if you were using Prototype.js instead of jQuery.
Walter