Here's a simple example that would appear in a Rails view:
<%= javascript_include_tag :defaults %>
<h1>Time Ajax Demo</h1>
<p><%= link_to_remote 'Get Current Time', :url => {:action => 'refresh'},
:update => 'currentTime' %>
</p>
<p id='currentTime'>
Current time will appear here
</p>
When the user clicks on the link, the browser makes an XMLHTTPRequest to the browser, which will get routed to the refresh method in the controller (this uses the default routing rule in routes.rb).
The refresh method in the controller renders string (using a view, partial or the render method) consisting of the current time.
The browser's javascript code takes the string and places it within the p tag that has the id of currentTime.