On 27 January 2011 13:47, Luke <[email protected]> wrote:
> Hi Rey,
> you shouldn't use timers for this - you canot be sure when an ajaxrequest
> has finished loading. There are parameters both in the ajax-methods and in
> morph that take functions that will be called on a specific event like when
> the ajax-call has been loaded (these are called callbacks).
> Check http://www.prototypejs.org/api/ajax/options section "Common callbacks"
> and http://madrobby.github.com/scriptaculous/core-effects/ for the part
> "callbacks".
> A simple usage would be
> new Effect.Morph( "myDiv", { style:"height:0px;",
>   afterFinish: function({
>     new Ajax.Request(url, {
>       onSuccess: function(transport) {
>         new Effect.Morph( "myDiv", { style:"height: 222px;overflow:hidden;"
> } );
>       }
>     });
>   })}
> );
>
> There might be syntax-errors in this

If you ALWAYS want the morph to occur, even after a failure with the
AJAX call, the I would recommend using onComplete.

Read about the "Common Callbacks" on http://api.prototypejs.org/ajax/

onComplete: Triggered at the very end of a request's life-cycle, after
the request completes, status-specific callbacks are called, and
possible automatic behaviors are processed. Guaranteed to run
regardless of what happened during the request.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to