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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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 Butler < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 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 > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 28 Mar 2008, at 12:49, Ryan Bigg (Radar) wrote:> 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 Butler <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > > wrote: > > 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. >So just use the right javascript! button_to_function ''Click me'', remote_function(:url => {...}, ...) Fred> 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 > -- > Posted via http://www.ruby-forum.com/. > > > > > > -- > Ryan Bigg > http://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email. > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 28 Mar 2008, at 12:49, Ryan Bigg (Radar) wrote: >> > So just use the right javascript! > button_to_function ''Click me'', remote_function(:url => {...}, ...) > > FredAh yes, thanks... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---