I'm using Rails version 3.0.9 and jquery. The problem is that when you click on the link, the div is not updated. There are two actions: "show" and "time". Initial position - show. Controller code was (ajax_controller.rb):
class AjaxController < ApplicationController
respond_to :html, :js
def show
end
def time
end
end
By clicking on the link in the div should be loaded time.
Next code (show.html.erb):
<h1>Ajax show</h1>
Click this link to show the current
<%= link_to "time", :url=>{:action => "time"}, :remote => true%>.<br/>
<div id='time_div'>
</div>
Also, there are files time.html.erb and time.js.erb. Follow code (time.js.erb):
$('#time_div').html('<%= escape_javascript(render :text => "The current time is #{Time.now.to_s}") %>');
But nothing happens. jquery connected. In what may be the problem?