We have very common need of displaying some loading animation while ajax call is going on background. There have been lots of help out there. Here is another repetitive version of it. It should work to any of the application out there.
<script language="javascript"> $('#loadingDiv') .hide() // hide it initially .ajaxStart(function() { $(this).show(); }) .ajaxStop(function() { $(this).hide(); }); </script> $('#loadImageLocation').prepend('<div id="loadingDiv" ><img id="theImg" src="<path of loading image>" /></div>');
In the above code make following changes
- Add a JQuery reference to your page.
- Change <path of loading image> to actual image url of loading animated image.
Happy JQuery!