Good day,

I have a page with several javascript pages that get loaded. How can I check that all the JS files have been loaded? I tried the below with just alert boxes.


function onPageLoad() {

        dataType: "json",
        type: "POST",
        contentType: "application/json; charset=utf-8",
     .done(function (data) {

    .fail(function () {


The alert does fire and shows Failed. What am I missing in my ajax call?


why are you using ajax post event? that is like a click event to post to the server yet your checking for somthing on the client side!

how about you wait on the dom to finish, you could have a loading event like a gif that loops that shows.... once the dom is complete you could fade out that image!

$(window).load(function() {

the above is going to wait for the dom to be ready before it fades out, that inclueds loading all js files!

.loadingImage is the class name of a div that will hold the rotating gif

<div class="loadingImage"><></></div>

css for the div that holds the rotating loading image.

    position: fixed;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
    z-index: 1500;
    background: url('/_layouts/images/loader.gif');

here were making it fixed and at the full size of the screen, were also making the position starting from the top/left and making the div image at the front of everything.

  • Ah ok, I get what you mean. The above method works perfectly! Keep well – Chester238 Dec 11 '13 at 9:24
  • no problem happy to help! – Ali Jafer Dec 11 '13 at 9:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.