Hi, this is my code:
<script language="javascript">
function refresh() {
try {
xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {}
xmlhttp.onreadystatechange = triggered;
xmlhttp.open("GET", "data.php");
xmlhttp.send(null);
}
function triggered() {
if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
document.getElementById("ins").innerHTML = xmlhttp.responseText;
}
document.getElementById("loading").style.display = "block";
}
</script>
<a href="javascript:refresh();">Refresh List</a>
The functions fails on the second time i call it,
Error: document.getElementById("loading") is null
Very strange, any fix for it?