I am trying to improve my knowledge of Rails. I was trying to use js.rjs in a simple code. Here's the view:
<div style="background: #000080; font-weight: bold; margin-left: 30px"><p>This should Remain Same</p></div>
<div id="noid">
<%=link_to 'Click',:action=>:say_when , :remote => true %>
and I will look it up.
</div>
And here's the controller:
class DemoController < ApplicationController
def say_when
respond_to do |format|
format.js
end
end
end
And I have views/Say_when.js.rjs as follows:
page.replace_html('noid', render(:text=>"OK"))
But when the "click" link is clicked, nothing happens. What am I doing wrong?