Reputation: 424
I'm trying to show a div that That indicates that the page is loading, for the load I use the jquery load event, however, the load div always stays on the page and there is no hidden end load, my code is this:
$("#mydiv").fadeIn("fast");
$('#page').load('myphp.php', { 'data': id },function(){
$("#mydiv").fadeOut("fast");
});
Upvotes: 2
Views: 1496
Reputation: 534
you can use $('#page').ajaxStart(callback);
and $('#page').ajaxStop(callback);
.
look here:
https://api.jquery.com/ajaxStart/
https://api.jquery.com/ajaxStop/
Upvotes: 0
Reputation: 3544
Hide the div
when the document finishes loading via
$(document).ready(function() {
$("#mydiv").fadeOut("fast");
});
(include this code after the rest of your JS in the header), e.g.
Upvotes: 1