View Full Version : Callback function executing immediately

02-12-2011, 07:02 PM
This question has appeared in a similar form in another thread however that issue was fixed only to present a slightly different one.

The problem is, the callback function is executing immediately rather than waiting for the fadeout to finish, any ideas ?

function loadBlog(){


var html = $.ajax({
url: "includes/blog.php",
async: false,
success: function(html) {

document.getElementById('content').innerHTML = html;
document.getElementById('contentBox').setAttribute("display", "none");

02-14-2011, 01:44 AM
So interestingly firefox does not have a problem, everything works perfectly.

Chrome will still not fadeout but does fadein and IE does not do any fading at all and simply immediately loads and displays the page.

This is driving me crazy :mad:

02-14-2011, 02:37 AM
Can you show that on a live site?

02-14-2011, 02:43 AM
Yeah sure its right here http://nomoredrilling.org.uk/Alexanders/index.php

02-14-2011, 03:33 AM
Apparently there is a problem with fading inline elements and/or fading elements that have no size.

So, giving the #contentBox "display: block" instead of "display: inline" might solve your problem.

02-14-2011, 11:47 AM
Well that has fixed things in chrome but still no joy in IE.

Interestingly I did have it working in IE, but the function was badly structured in that it was actually calling itself three times, which was causing some issues with the contact form submission so I altered that and now I have this problem.

02-14-2011, 06:02 PM
If you don't feel like tracking down the error, you could fade $('.content') instead.

02-15-2011, 09:49 AM
Hmmm yes, I might just go back to the old crappy slightly broken but somehow working for IE way. Hot dang.

Thanks for your help anyway.