[FX.php List] [off] Forcing jQuery to wait for a PHP page to render

Steve Winter steve at bluecrocodile.co.nz
Wed Jan 18 09:56:35 MST 2012


Hey Bob

If I understand the problem correctly, the fadeOut occurs, but the fadeIn also occurs again before page B has loaded, is that correct…?

In which case, try

$('.make_cell').click(function(){
	var theid = $(this).attr('id');
	$('#content')
	.fadeOut()
	.load('v2_hero.php?mk=' + theid, function() {$('#content').fadeIn(); });
	return false;
});

What this is doing is making the fadeIn occur once the load is complete i.e. it's the success callback function (see http://api.jquery.com/load/)

Cheers
Steve


> Is there a way to force jQuery to wait until a PHP page renders? Here's what I'm seeing:
> 
> Using this code:
> 
> $('.make_cell').click(function(){
> 	var theid = $(this).attr('id');
> 	$('#content')
> 	.fadeOut()
> 	.load('v2_hero.php?mk=' + theid)
> 	.fadeIn();
> 	return false;
> });
> 
> I see this:
> 
> (assuming my DIV contains page "A" and is loading in "B")
> 
> I'm viewing page A
> I click the link to load page B
> 
> I see a fadeIn and see page A
> … then in a second or less, B loads
> 
> Is this because my PHP page hasn't fully rendered yet and the jQuery outran it? If so, is there a way to tell JQ to wait for the PHP to fully render?
> 
> Thanks,
> 
> Bob Patin
> Longterm Solutions LLC
> bob at longtermsolutions.com
> 615-333-6858
> http://www.longtermsolutions.com
> FileMaker 9, 10 & 11 Certified Developer
> Member of FileMaker Business Alliance and FileMaker TechNet
> --
> Twitter: bobpatin
> Google+: http://www.longtermsolutions.com/plus
> AIM: longterm1954
> iChat: bobpatin
> --
> Expert FileMaker Consulting 
> FileMaker Hosting for all versions of FileMaker
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list

Steve Winter
+44 777 852 4776
steve at bluecrocodile.co.nz



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20120118/8adc517c/attachment.html


More information about the FX.php_List mailing list