If I got you well:
Before you make an ajax call, you display an animated pic (rotates for example) to show the user that you are loading data and once you finish you need to hide it.
If this is the case then you should do the following (am only describing process here, but if you want code change post yours so we can help more):
- Before the call make an ajax object (var ajaxCall = new YourFunction());
- Assign a method onreadystate as follows:
ajaxCall.onreadystatechange = function()
if(ajaxCall.readyState == 4)//this means that the data is loaded
//here do what you want to do, fill the html.
//here after the html is filled and all your steps are done hide the rotating image