Ajax call on button

How do i use a button to perform an ajax call. Im not updating/creating
a form so submit_to_remote wont work as it is expecting form options.

button_to_function is just for javascript from what ive read.

I could use css to maybe appear that it is a button but this is not the
route i want to take.

<%= submit_to_remote ‘next_lever_btn’, “Go to next” ,
:url => { :action => “load_questions”, :id => @next_cat},
:before => “Element.show(‘main_spinner’)”,
:success => “Element.hide(‘main_spinner’)” %>

Anyone got a solution?

JB

You could use a link_to_remote and style it the way you want it.

On Fri, Mar 28, 2008 at 10:39 PM, John B. <
[email protected]> wrote:

:url => { :action => “load_questions”, :id => @next_cat},


Ryan B.
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.

Frederick C. wrote:

On 28 Mar 2008, at 12:49, Ryan B. (Radar) wrote:

So just use the right javascript!
button_to_function ‘Click me’, remote_function(:url => {…}, …)

Fred

Ah yes, thanks…

On 28 Mar 2008, at 12:49, Ryan B. (Radar) wrote:

So just use the right javascript!
button_to_function ‘Click me’, remote_function(:url => {…}, …)

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs