I am using a DIV to load pages that must be refreshed every so often however due to the delay in each load, it takes that amount of time to load the first preview. So what I want to do is while the page loads it up is there a possibility of placing some sort of loading icon/image/message until it gets the page contents.

The code I am currently using is:

<script>
var refreshId = setInterval(function()
{
$('#bprofile').load('Bupdate.php');
}, 10000);
</script>

<div id="bprofile"></div>

So the above loads onto the page if the page is refreshed or loaded and will load the external page every 10 seconds and every 10 seconds after that, during which time I would like to place some sort of loading image or message until it loads the external page...
Is this possible?

Thanks in advance! :)

try the idea, maybe it help

<script>
var refreshId = setInterval(function() {
document.getElementById('loading').style.display="block";
$('#bprofile').load('Bupdate.php');
document.getElementById('loading').style.display="none";
}, 10000);

</script>
<div id="loading" style="display:none;"><img src="sample_loading_icon.gif" ></div>
<div id="bprofile"></div>

Doesn't show the loader for me but refreshes as normal...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.