On my page I have javascript that loads new content in <div id="content"></div>
from other page located at: inc/content.php
. I would like to know how can I show animated gif image loading.gif
in <div id="content"></div>
while new content gets loaded into it? and once loaded hide gif and show new conntent?
Thank You ))) Here is my code:
<html>
<head>
<script type="text/javascript" src="js/jquery-1.6.4.js"></script>
<script type="text/javascript">
function viewNext()
{
$("#content").load("inc/content.php");
}
</script>
</head>
<body>
<button id="nextfLuky" onClick="viewNext();return false;">Next fLuky</button>
<div id="content"></div>
</body>
</html>
content in inc/content.php page:
<div id="text">Hello</div>
This will do it.
When you use load() it will replace anything in the element, including the gif so you dont have to manually hide it.