When a page is finished loading. Then I want to load a module other, smaller, inside it using jQuery. What should I do?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to wait for the every asset to finish loading, then do something like this:
You can also use an optional callback method:
jQuery docs for
$.getScript()Just to be clear,
$(window).load()fires when everything on the page has finished loading including other scripts and images.$(document).ready()fires as soon as the DOM can be manipulated, which is often much sooner than$(window).load().