# called javascript method and ruby method with 1 button?

**URL:** <https://discuss.rubyonrails.org/t/called-javascript-method-and-ruby-method-with-1-button/11995>\
**Category:** rubyonrails-talk\
**Created:** [April 22, 2007, 3:30pm UTC](https://discuss.rubyonrails.org/t/called-javascript-method-and-ruby-method-with-1-button/11995 "2007-04-22T15:30:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Latta](https://avatars.discourse-cdn.com/v4/letter/m/d26b3c/32.png) [@Michael\_Latta](https://discuss.rubyonrails.org/u/Michael_Latta)\
**Post date:** [April 22, 2007, 3:30pm UTC](https://discuss.rubyonrails.org/t/called-javascript-method-and-ruby-method-with-1-button/11995/1 "2007-04-22T15:30:28Z")

</div>

You can use the link\_to\_function helper to setup the call to JS or just use straight js to do that. Inside your js function use Ajax.Request or one of its subclasses to call the controller action using XmlHttpRequest.

Michael
