This has come up a few times - pretty sure there isn't a super clean way of doing it, but I'd probably prefer something like this:
$("#div1").load( "scripts/generateA.php", {VAR: var}, checkLoaded ); $("#div2").load( "scripts/generateB.php", {VAR: var}, checkLoaded ); $("#div3").load( "scripts/generateC.php", {VAR: var}, checkLoaded ); $("#div4").load( "scripts/generateD.php", {VAR: var}, checkLoaded ); checkLoaded = function() { $(this).data(loaded: true); if ( $('#div1').data('loaded') && $('#div2').data('loaded') && ... etc ) { // some final call. } } On May 20, 8:52 am, "Alexandre Plennevaux" <[EMAIL PROTECTED]> wrote: > here is how i would try it, simply using the load() function built-in > callback parameter > > $("#div1").load( "scripts/generateA.php", {VAR: var} ,function(){ > $("#div2").load( "scripts/generateB.php", {VAR: var}, > function(){ > $("#div3").load( "scripts/generateC.php", {VAR: var}, function(){ > $("#div4").load( "scripts/generateD.php", {VAR: var} ); > > > > > > } ); > } > ); > }); > On Mon, May 19, 2008 at 10:39 PM, FreeKill <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I'm thinking there is something I'm just overlooking, but I hope > > someone can help... > > > I have a set of load calls that are each made at document load: > > > $("#div1").load( "scripts/generateA.php", {VAR: var} ); > > $("#div2").load( "scripts/generateB.php", {VAR: var} ); > > $("#div3").load( "scripts/generateC.php", {VAR: var} ); > > $("#div4").load( "scripts/generateD.php", {VAR: var} ); > > > What I want to do is make a 5th load call, but only once the previous > > 4 are completed. Is there a way to wrap a block of calls in a way that > > a Callback function is called when they call complete? > > > I can think of some other, less optimal ways of getting this > > accomplished, but I'm hoping someone might know how to do it the way > > I've got it going now. > > > Any suggestions? Your help is appreciated... > > -- > Alexandre Plennevaux > LAb[au] > > http://www.lab-au.com- Hide quoted text - > > - Show quoted text -