Dear reader,

i would like to indicate that an ajax query is in progress with one of those animated gifs.
In theory the image is hidden, until ajax is working and waiting for a response. When the response comes it is hidden again.

I have tried several approaches to this since now without success.

http://www.w3schools.com/ajax/ajax_database.asp

I started with this routine, a select-form that fires the ajax onchange and returns db-values to a specified section. Right behind the select field i would like the indicator to appear.

My question: How to i show/hide the animated gif in this case?

Thanks for your patience.

Solved:

<img src="loading2.gif" alt="Ajax Indicator" id="hide" style="visibility:hidden" />

and

xmlhttp.onreadystatechange=function()
{
document.getElementById('hide').style.visibility = "visible";
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
document.getElementById('hide').style.visibility = "hidden";
}
}

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.