philmetz
02 Jan 2011, 05:02 AM
I have a function using Ajax to get data and while it gets the data a loading image appears but its not appearing, something wrong with the <img> syntax:
print("
<script type=\"text/javascript\">
var http = false;
http = new XMLHttpRequest();
function validate(user) {
http.abort();
document.getElementById('test').innerHTML = \"<img src=\"images/load.gif\"/>\";
http.open(\"GET\", \"tracks.php?name=\" + user, true);
http.onreadystatechange=function() {
if(http.readyState == 4) {
document.getElementById('test').innerHTML = http.responseText;
}
}
http.send(null);
}
</script>
");
How do i fix that?
print("
<script type=\"text/javascript\">
var http = false;
http = new XMLHttpRequest();
function validate(user) {
http.abort();
document.getElementById('test').innerHTML = \"<img src=\"images/load.gif\"/>\";
http.open(\"GET\", \"tracks.php?name=\" + user, true);
http.onreadystatechange=function() {
if(http.readyState == 4) {
document.getElementById('test').innerHTML = http.responseText;
}
}
http.send(null);
}
</script>
");
How do i fix that?