Your second attempt looks the closest. I would try it like this: $('.ajax-div-slide').click(function() { var url = this.href; $('#ajax-loader').animate({height: 375}, 'slow', function(){ $('#ajax-div').load(url); }); return false; });
But I've got to ask... why do you want to delay an operation that already has inherent latency, just so that you can show an animation? Don't you want to show the ajax-loader *while* the ajax request is active? On 3/16/07, Yansky <[EMAIL PROTECTED]> wrote: > > How can I get an ajax request (that is triggered by a click event) wait for > an animation to complete (which is also triggered by the same click event) > before it runs the ajax request? > > e.g. this is what I'd like to do: > > $('.ajax-div-slide').click(function (){ > $('#ajax-div').ajaxSend(function(){ > $('#ajax-loader').animate({height: 375}, 2000); > }); > //only start the ajax once the animation has finished > $('#ajax-div').load(this.href); > return false; > }); > > As well as the above example, I've also tried: > > $('.ajax-div-slide').click(function(){ > var passClick = $(this) > $('#ajax-loader').animate({height: 375}, 'slow', function(passClick){ > $('#ajax-div').load(passClick.href); > }); > return false; > }); > > ...and... > > $('.ajax-div-slide').click(function (){ > $this($('#ajax-loader').animate({height: 375}, 2000, function(){ > $('#ajax-div').load(this.href); > }); > ); > return false; > }); > > ...without any success. > > Anyone have any ideas as to how I can achieve this? > > Cheers. > -- > View this message in context: > http://www.nabble.com/Event-%3EAJAX-wait-before-animation-completes-tf3412929.html#a9509661 > Sent from the JQuery mailing list archive at Nabble.com. > > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/