What do you mean inside?
like this :

Ajax.Responders.register({
onCreate: function() {
        if($('loading_box') && Ajax.activeRequestCount>0)
                $(el_div).hide();
                $('loading_box').show();
        },
onComplete: function() {
    if($('loading_box') && Ajax.activeRequestCount==0)
                $('loading_box').hide();
                Effect.Appear(el_div, {duration:1.0, queue:'end'});
        }
});

function update_div(el_div, url) {
        new Ajax.Updater({success:el_div}, url, {method:'get'});
}

Try that, but doesnt understand what el_div is thus the effect.Appear
doesnt work anymore...



On May 4, 11:39 pm, kangax <[EMAIL PROTECTED]> wrote:
> What's wrong with just using it inside your callback?
> It will be resolved when function is called (to whatever that variable
> references)
>
> - kangax
>
> On May 4, 10:55 pm, semon <[EMAIL PROTECTED]> wrote:
>
> > Hello,
> > I've created a nice function using prototype and scriptaculous. Very
> > limited but with a very nice effect. Essentially, when ever i call
> > ajax i show a loading indicator and then hide the indicator and use
> > the effect.Appear effect to show the content returned. Here's my
> > sample:
>
> >http://www.servandomontero.com/test/test_ajax/index.html
>
> > My question is how i can i pass an element id to the
> > Ajax.Responders.register 'listener'.
>
> > In the code below, in the function 'update_div' i use a
> > 'div' (el_div). That div (el_div) should be use in the
> > Ajax.Responders.register but i don't know how to pass that parameter
>
> > So instead of $('products').hide(); it should be something like : $
> > (el_div).hide();
>
> > Can i pass parameters to the Ajax.Responders.register from the
> > function update_div?
>
> > CODE:
> > ------------
> > Ajax.Responders.register({
> > onCreate: function() {
> >         if($('loading_box') && Ajax.activeRequestCount>0)
> >                 $('products').hide(); // *** SHOULD BE $(el_div).hide();
> >                 $('loading_box').show();
> >         },
> > onComplete: function() {
> >     if($('loading_box') && Ajax.activeRequestCount==0)
> >                 $('loading_box').hide();
> >                 Effect.Appear('products', {duration:1.0, queue:'end'}); // 
> > ***
> > SHOULD BE Effect.Appear(el_div, {duration:1.0, queue:'end'});
> >         }
>
> > });
>
> > ----------
>
> > function update_div(el_div, url) {
> >         new Ajax.Updater({success:el_div}, url, {method:'get'});
>
> > }
>
> > ------------
>
> > Can i pass parameter to the Ajax.Responders.register ?
>
> > Thanks
> > marco
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to