To clarify what Cesar said, the loading function _has_ finished executing (ie, modifying the DOM). You need to preload any images first so they don't have download it when the function fires.
eg: http://www.ilovejackdaniels.com/css/preloading-images-with-css/ On Jan 9, 8:40 am, "Cesar Iduarte" <[EMAIL PROTECTED]> wrote: > On Jan 8, 2008 12:38 PM, rics <[EMAIL PROTECTED]> wrote: > > > > > > > > > Hello people, > > > How can I force some code to run only when the execution of other > > function finish? Look my code: > > > function loading() { > > $("#ajaxContent").slideToggle("normal", function() { > > $("#ajaxLoader").toggle(); > > }); > > } > > > $("#searchBar > button").click(function() { > > loading(); > > $.get("ajax/list.php", function(data){ > > $("#ajaxContent").html(data); > > loading(); > > }); > > }); > > > In the second block of code I want the $.get to execute only when the > > function loading(), that was coded by me, finish to execute. I mean, > > when the #ajaxLoader is show up. > > > How can I do something like that? > > If I'm getting right... ur results display before ur "loading" image even > appear... > If that so... you could use a timer with a constant delay 'cuse u really > don't know how long it takes to the browsers shows ur "loading" display... > > -- > Innovation the most beautiful Imagination's result- Hide quoted text - > > - Show quoted text -