Ajax after page fully loaded

1

I have a very slow code running on the server side, to avoid the delay in rendering on the page, I decided to call the function via ajax after the page loaded, I used both ways but both did not work:

With $(document).ready the page is displayed, but font files (Google Fonts) and icons are loaded after.

$(document).ready(function() {
    $.ajax({ ... });
});

Already with $(window).bind the page is fully displayed after completing the function.

$(window).bind("load", function() {
    $.ajax({ ... });
});
    
asked by anonymous 26.10.2014 / 02:05

1 answer

1

The ready method is executed once the DOM is complete, this does not mean that your page is fully rendered.

Try using the following code:

window.onload = function() { <seucódigoaqui> };
    
27.10.2014 / 14:47