Topic: How to write Multiple callbacks for link_to_remote ?

Hello all,

i want to do multiple things when the request is complete, how do i write the code? i try to pass a hash to it without luck, i tried to write two :complete => with no luck as well.

have a look at the code, you'll see what i mean.

<%= link_to_remote "Add SubPlace", :url => { :action => 'suggest_subplace', :id => @place },
        :update => 'subplace_display',
        :before => %(Element.show('subplace-spinner')),
    :success => %(Element.hide('subplace-spinner')),
        :complete => %(Element.replace('sub', 'hahahahaha')),
        :complete => visual_effect(:blind_down, 'subplace_display'%>

thanks in advance.

Re: How to write Multiple callbacks for link_to_remote ?

I'm not sure about how to do all the stuff you want to do with rjs, but maybe this will help a little?

link_to_remote(blablabla, :complete => "$('div_id_1').show();
                                        $('div_id_2').do_something_else();")

Re: How to write Multiple callbacks for link_to_remote ?

You could have Ajax call an RJS template and return javascript.

Alternatively, you create you own client-side function and call that from complete:

  :complete => "myFunction()"

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================