1
I have a very slow code running on the server side, to avoid the delay in rendering the page, I decided to call the function via ajax
after the page loaded, I used both ways but both did not work:
With the $(document).ready
the page is displayed, but files from fonts (Google Fonts) and icons are loaded after.
$(document).ready(function() {
$.ajax({ ... });
});
Already with the $(window).bind
the page is fully displayed after completing the function.
$(window).bind("load", function() {
$.ajax({ ... });
});
You want to call an ajax after the fonts are loaded eh this?
– leonardo
Exactly @Leonard
– Lucio Rubens
Take a look at this topical It seems that the solution does not work well in all browsers, so the recommended was to use
setTimeout
to achieve the desired result.– evsar3
Can you put the code you have now to load the fonts? If they are inside the
<head>
carry before thedomready
orload
– Sergio
Is using the
$(window).bind("load", ...
at the top of the page? I think it has to be to work properly.– Miguel
I didn’t quite understand the problem. The variation with
bind
gives the result you want?– bfavaretto
Place the ajax at the bottom of the page
– Alexandre Sousa