RJS Doesn't work for me :(

Joe Ruby MUDCRAP-CE wrote:

I'm developing on my Mac OS X Powerbook using just Mongrel. I've been
trying to get the simplest of RJS to work:

# view
<div id="test">ruby</div>

link_to_remote 'update', :url=>{:action=>:doit}

# controller
def doit
  render :update do |page|
    page.replace_html('test', 'rails')
    # page['test'].replace_html('rails') # doesn't work either
    # page['test'].value = 'rails' # doesn't work either
    # page.hide 'test' # doesn't work either
    # bunch of other RJS attempts that don't work...

Am I missing something? The link appears to work, as clicking it shows
up in the log. I have no idea why it's not working, unless maybe it's a
Mongrel-only thing (as opposed to using Mongrel and Lighty) -- but
that's a shot in the dark. Or maybe it's related to using controller
modules? If I add ":update=>'test'" to the link tag, the div gets
changed to "Element.update("test", "rails");" or
"$('test').value='rails'" or whatever. I've restarted Mongrel many
times, tried it in Safari, refreshed, checked my javascript settings (it
does seem like the javascript isn't getting run for some reason), etc.
-- all to no avail. Anybody have ANY idea what the problem might be? I'm
getting cross-eyed...


Posted via http://www.ruby-forum.com/.

Sounds like you forgot to put...

<%= javascript_include_tag :defaults %>

in the head of your layout file.


I'd get a copy of the firebug extension for firefox and see what the
AJAX request/response looks like.