# RJS Doesn't work for me :(

**URL:** <https://discuss.rubyonrails.org/t/rjs-doesnt-work-for-me/2210>\
**Category:** rubyonrails-talk\
**Created:** [September 27, 2006, 3:01am UTC](https://discuss.rubyonrails.org/t/rjs-doesnt-work-for-me/2210 "2006-09-27T03:01:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![olbrich](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/olbrich/32/10820_2.png) [@olbrich](https://discuss.rubyonrails.org/u/olbrich)\
**Post date:** [September 27, 2006, 3:01am UTC](https://discuss.rubyonrails.org/t/rjs-doesnt-work-for-me/2210/1 "2006-09-27T03:01:30Z")

</div>

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 &nbsp;&nbsp;render :update do |page| &nbsp;&nbsp;&nbsp;&nbsp;page.replace\_html('test', 'rails') &nbsp;&nbsp;&nbsp;&nbsp;# page['test'].replace\_html('rails') # doesn't work either &nbsp;&nbsp;&nbsp;&nbsp;# page['test'].value = 'rails' # doesn't work either &nbsp;&nbsp;&nbsp;&nbsp;# page.hide 'test' # doesn't work either &nbsp;&nbsp;&nbsp;&nbsp;# bunch of other RJS attempts that don't work... &nbsp;&nbsp;end end
> 
> 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...
> 
> Thanks, Joe
> 
> -- Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

Sounds like you forgot to put...

\<%= javascript\_include\_tag :defaults %\>

in the head of your layout file.

\_Kevin

---

<div class="post-metadata">

**Author:** ![olbrich](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/olbrich/32/10820_2.png) [@olbrich](https://discuss.rubyonrails.org/u/olbrich)\
**Post date:** [September 27, 2006, 4:00am UTC](https://discuss.rubyonrails.org/t/rjs-doesnt-work-for-me/2210/2 "2006-09-27T04:00:30Z")

</div>

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

\_Kevin
