Use the jQuery ready event:
While JavaScript provides the load event for executing code when a page is rendered, this event does not get triggered until all assets such as images have been completely received.
Question
In my new website, there are number of ajax calls.Now the content is displaying when it's ready. I want to add a pre-loader until everything in the div gets loaded completely. I've used load() function but its not working properly.
Solution
Use the jQuery ready event:
While JavaScript provides the load event for executing code when a page is rendered, this event does not get triggered until all assets such as images have been completely received.