I have the following AJAX script:
function callAHAH(url, pageElement, errorMessage) {
document.getElementById(pageElement).innerHTML;
try {
req = new XMLHttpRequest(); /* e.g. Firefox */
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP"); /* some versions IE */
} catch (e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP"); /* some versions IE */
} catch (E) {
req = false;
}
}
}
req.onreadystatechange = function() {responseAHAH(pageElement, errorMessage);};
req.open("GET",url,true);
req.send(null);
}
I am trying to implement a loading animation but cannot get it to work. I imagine I will need to use a variable for line #2 but I am not very familiar with javascript. Currently I have an img in place with an id assigned to it. I just need help figuring out how to properly call it in the javascript. If there are any questions please let me know.
One more thing I want to mention is that I current have the image set to display: none; so I imagine I will need .style.display = ''; in the script.