In this code, triggered when when the user fills out the shipping info,
this code fades the form div, displays the loader gif, loads the billing
form into the form div, fades the loader and then fades in the form div.
Each fadeIn, fadeOut or load function has a second parameter which
consists of another function that is triggered once the preceeding
function is complete. That way nothing happens until the preceding step
is complete.
$("#formdiv").fadeOut("fast", function(){
$("#loader").fadeIn("fast", function(){
$("#formdiv").load("/billingform.php", function(){
$("#loader").fadeOut("fast", function(){
$("#formdiv").fadeIn("fast");
}); });});});
Dave Maharaj :: WidePixels.com wrote:
I am new to jQuery and have a newbie question.
I have a link click load into div. Thats all good. But how do I add
effects? I read the jQuery docs and there are success: complete:
error: but looking thru example online I have not seen this any where.
Basicaly I want that click on the link it fades out showing the
loading animation, the load my url function runs and when
complete/error hides the animation and display success or error message.
I started paying around with this
$('a.save_me').click(function(){
$('#loading').show();
$('a.save_me').fadeOut('slow').load(
$(this).attr('href'),
function() {
$('#loading').hide();
});
});
but still not working.
Can someone point me in the right direction?
Thanks
Dave