I was having fun with rails right up until ajax. And now want to burn the whole thing down. Please explain what I am doing wrong here.
index.html.erb contains:
<%= javascript_include_tag ‘prototype’ %>
…
I AM RJS
<%= link_to_remote(“hello”, :update => “rjs”, :url => {:action => “hello_dude”}) %>
the controller file contains:
def hello_dude
render :text => Time. now
end
So far everything is works. Now I try use let the rjs file :
change the controller file to
def hello _dude
respond_to do |format|
format.js
end
With the hello_dude.rjs file containing:
page.insert_html :bottom, :rjs, Time.now.to_s
Here is what shows up in my browser:
try { Element.insert(“RJS”, { bottom: “Wed Jul 22 23:28:17 -0700 2009” }); } catch (e) { alert(‘RJS error:\n\n’ + e.toString()); alert(‘Element.insert("RJS", { bottom: "Wed Jul 22 23:28:17 -0700 2009" });’); throw e }
I don’t get it. Please help me get rid of this annoying error message.
Thanks,
Tim