Call function on div load. Just like nginit in angualrjs. It will show a CSS-only loading spinner automatically. The load() method loads data from a server and puts the returned data into the selected element. Nov 23, 2024 ยท One straightforward approach to call a function when the page loads is to use the window. In this step-by-step tutorial, we will explore how to achieve this functionality and provide examples along the way. onload property. What I want to achieve is that I load the div contents via ajax and on every page resize I want to call the draw method of each div. Below are the following methods by which we can execute JavaScript after page load. The onload event can also be used to deal with cookies (see "More Examples" below). I now don't want to return a draw1, drawn from the ajax calls, just the generic draw method. 4wgfhxt4s3wd9rnntxs4mrzx1qufb2dtue7wqwkub3d