Maybe it's not appearing because the AJAX call is being executed too fast? What happens if you do something like this:
Code:
var http = null;
function validate(user) {
http.abort();
document.getElementById('test').innerHTML = '<img src="images/load.gif"/>';
window.setTimeout(function() {request(user);}, 2000);
}
function request(user) {
http.open("GET", "tracks.php?name=" + user, true);
http.onreadystatechange=function() {
if(http.readyState == 4) {
document.getElementById('test').innerHTML = http.responseText;
}
}
http.send(null);
}
EDIT: Ah, and even more important. By doing this
Code:
print("document.getElementById('test').innerHTML = \"<img src=\"images/load.gif\"/>\";");
you will get this in javascript
Code:
document.getElementById('test').innerHTML = "<img src="images/load.gif"/>";
which is a wrong use of quotes