I am running Rails 3.0.7 with Ruby 1.9.2 and using jquery. I ran
$ rails generate jquery:install
to get the right javascript files for AJAX.
HTML:
<%= javascript_include_tag :all %>
…
say_when.js.rjs:
page.replace :time_div, “
The time is #{DateTime.now.to_s} </
p>”
When I click on the link, instead of replacing the div html, the
entire page is replaced with the generated javascript:
try {
Element.replace(“time_div”, "
The time is
2012-04-11T16:43:23-04:00
} catch (e) { alert(‘RJS error:\n\n’ + e.toString());
alert(‘Element.replace(“time_div”, "
The time is
2012-04-11T16:43:23-04:00
page.replace_html does the same thing.
What am I doing wrong?