# javascript without rjs

**URL:** <https://discuss.rubyonrails.org/t/javascript-without-rjs/28409>\
**Category:** rubyonrails-talk\
**Created:** [April 22, 2008, 10:41pm UTC](https://discuss.rubyonrails.org/t/javascript-without-rjs/28409 "2008-04-22T22:41:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Col\_Wilson](https://avatars.discourse-cdn.com/v4/letter/c/46a35a/32.png) [@Col\_Wilson](https://discuss.rubyonrails.org/u/Col_Wilson)\
**Post date:** [April 22, 2008, 10:41pm UTC](https://discuss.rubyonrails.org/t/javascript-without-rjs/28409/1 "2008-04-22T22:41:26Z")

</div>

I've been googling for ages, please help.

I don't want to use rjs and the view helpers for prototype, I just want to render javascript (jquery), and no I don't want to use jrails either as this just partially mimics those same helpers.

Can't I just render a some\_action.js file?

Rails 2.0.2

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [April 22, 2008, 11:58pm UTC](https://discuss.rubyonrails.org/t/javascript-without-rjs/28409/2 "2008-04-22T23:58:42Z")

</div>

> Can't I just render a some\_action.js file?

Not entirely sure if that's what you mean (it's way past my bedtime :), but I use a JavascriptsController. This way, a request to '/javascripts/some\_action.js' will be either satisfied by serving a static file from public/javascripts, or if no such file exists, by a controller method of that name from my JavaScriptsController, which renders a nice dynamic show\_action.js.erb view.

Hope this helps, Jan

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [April 23, 2008, 10:24am UTC](https://discuss.rubyonrails.org/t/javascript-without-rjs/28409/3 "2008-04-23T10:24:31Z")

</div>

I'm well rested now, but I am still not sure what you're trying to achieve. You are not bound to use any helpers at all; you are free to write JS directly into your views the usual way if that is what you prefer.

If you want to include an external script into a view, just put it into the public/javascripts folder of your application and include it either manually or through the javascript\_include\_tag helper.

The JavascriptsController only makes sense if you have the need to create JS dynamically, say, with ERb.

I'd be happy to provide examples, I just need to know which direction you're heading here.

Cheers, Jan

---

<div class="post-metadata">

**Author:** ![Col\_Wilson](https://avatars.discourse-cdn.com/v4/letter/c/46a35a/32.png) [@Col\_Wilson](https://discuss.rubyonrails.org/u/Col_Wilson)\
**Post date:** [April 24, 2008, 6:49pm UTC](https://discuss.rubyonrails.org/t/javascript-without-rjs/28409/4 "2008-04-24T18:49:52Z")

</div>

Yes, I want to create raw (at least not using helpers) dynamically, so I could use e.g. jquery.
