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!
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
css for the div that holds the rotating loading image.
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.