Reputation: 1775
I have 2 pages, when the second page load in first page, the JavaScript of that pages run after all the JavaScript and load very slowly. I wrote the below code to show the spinner till the second page load completely. But the spinner doesn't s work. Here is my code:
<script>
$('.tourajaxi').html('<i class="fa fa-spinner fa-pulse fa-3x fa-fw" ></i><span class="sr-only">Loading ...</span>');
$(window).load(function() {
$('.tourajaxi').load('/toursajax.bc?gid=325');
});
</script>
Upvotes: 6
Views: 345
Reputation: 4079
A guess, since you haven't included any HTML:
Your script is in the <head>
of the document, and tries to apply HTML to the element "tourajaxi", but that element does not exist until the rest of the document is loaded.
Upvotes: 1