The following piece of code is intended to put the contents of a text file within a div. Because the text file can be upgraded, that the div is updated with the latest content of the file. But every 2 seconds the div content flashes. How can I achieve the same goal without the content of the div blinking? Thank you.
<script type="text/javascript">
setInterval("loadXMLDoc()",2000);
function loadXMLDoc(){
var xmlhttp;
// codigo para IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function(){
document.getElementById("minhaDiv").innerHTML=xmlhttp.responseText;
}
xmlhttp.open("GET","ajax_doc.txt",true);
xmlhttp.send();
}
</script>