Re: [Proto-Scripty] Using effects after AJAX

2010-04-02 Thread Guillaume Lepicard
hi,
you have to handle an extra parameter in your getdata function which should
be a
callback function to call when ajax request is complete.

your getdata should then look like :
function getdata(whatdata,whatdiv, callBack) {
  new Ajax.Updater(whatdiv, someURL, {
   parameters:whatdata,
   onComplete: callBack
});
}

you could then call it that way:

getdata(whatdata,whatdiv, function(){
  new Effect.Slidedown(whatdiv);
});


On Fri, Apr 2, 2010 at 3:21 AM, Barry Smyth  wrote:

> I have a webpage that loads data into a DIV using the AJAX
> getdata(whatdata,whatdiv) function.
>
> Initially the DIV is hidden and I only want it displayed using the
> Effect.Slidedown function once the data has been loaded into the DIV.
>
> The problem is if I place the Effect.Slidedown function after the
> getdata call nothing happens. If I place the effect.slidedown before
> the getdata call it works in a way but the box jumps down (I'm
> guessing because when its called the size of the DIV isn't correct
> height as its having data loaded into it by the getdata call).
>
> The problem seems to be that the AJAX getdata call somehow changes the
> way javascript after the AJAX command works.
>
> I was wondering if anyone has had a similar problem and if they
> managed to find a solution.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Using effects after AJAX

2010-04-02 Thread Barry Smyth
I have a webpage that loads data into a DIV using the AJAX
getdata(whatdata,whatdiv) function.

Initially the DIV is hidden and I only want it displayed using the
Effect.Slidedown function once the data has been loaded into the DIV.

The problem is if I place the Effect.Slidedown function after the
getdata call nothing happens. If I place the effect.slidedown before
the getdata call it works in a way but the box jumps down (I'm
guessing because when its called the size of the DIV isn't correct
height as its having data loaded into it by the getdata call).

The problem seems to be that the AJAX getdata call somehow changes the
way javascript after the AJAX command works.

I was wondering if anyone has had a similar problem and if they
managed to find a solution.

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.