# Can rjs be called from a javascript function

**URL:** <https://www.ruby-forum.com/t/can-rjs-be-called-from-a-javascript-function/133311>\
**Category:** Rails\
**Created:** [March 29, 2008, 11:28pm UTC](https://www.ruby-forum.com/t/can-rjs-be-called-from-a-javascript-function/133311 "2008-03-29T23:28:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbqbaker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecccb3/32.png) [@bbqbaker](https://www.ruby-forum.com/u/bbqbaker)\
**Post date:** [March 29, 2008, 11:28pm UTC](https://www.ruby-forum.com/t/can-rjs-be-called-from-a-javascript-function/133311/1 "2008-03-29T23:28:51Z")

</div>

is it possible to call a rjs file from a javascript function??

---

<div class="post-metadata">

**Author:** ![bbqbaker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecccb3/32.png) [@bbqbaker](https://www.ruby-forum.com/u/bbqbaker)\
**Post date:** [March 31, 2008, 3:36pm UTC](https://www.ruby-forum.com/t/can-rjs-be-called-from-a-javascript-function/133311/2 "2008-03-31T15:36:53Z")

</div>

Not sure if this is what you’re asking, but you can do the following:

new Ajax.Request(‘some\_url’, …)

(Check out [prototypejs.org](http://prototypejs.org) for details). That will issue a request to  
the url as an ajax request… which will ask for an ‘rjs’ response.  
Better still, if you don’t need to embed the call in other javascript  
then you can do this:

remote\_function(:url=\>‘some\_url’, :submit=\>‘form\_id’, etc.)

[http://www.railsbrain.com/api/rails-2.0.2/doc/index.html?a=M001834&name=remote\_function](http://www.railsbrain.com/api/rails-2.0.2/doc/index.html?a=M001834&name=remote_function)

On Mar 29, 6:28 pm, Koloa N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
