Reputation: 15002
In my View af_form.html.erb
I have a button for trrigering ajax call
<%= button_to('update ', {:action => 'update', :thingyid => 314}, :method => :get, :remote => true , :'data-update-target' => 'af_stat' ) %>
<div id="af_stat" >
<h3>Tiltle :
<%= @kk %>
</h3>
somebody says I should have a file called _af_form.html.erb what should the _af_form.html.erb should be?
In my controller welcome , there is an method
def update
@kk = @kk +1
render :partial => 'af_form', :content_type => 'text/html'
end
I heard someone said..."just same as af_form.js.erb" ? isn't it stupid? copy two identical files.and disobey DRY rule.
and it doesn't work . what's wrong. anyone can help me. thanks you very much.
i just want to change the view af_form.html.erb not _af_form.html.erb , why should i need _af_form.html.erb
Upvotes: 3
Views: 1312
Reputation: 29599
try this inside your update.js.erb
$('#af_stat h3').text('Title: <%= escape_javascript @kk %>');
Upvotes: 1