The following code I am using to update a textarea dynamically without reloading the entire page.
It was working last night but stopped working when I tried using it this morning. The alert(request.readyState+" "+request.status) returns 2 0 and 4 0… help?
<script type="text/javascript">
function init(){
var url="http://www.suchandsuch.net/ChatBowl/text.txt";
var request= new XMLHttpRequest();
request.open("GET",url,true);
request.onreadystatechange= function(){
//alert(request.readyState+" "+request.status);
if (request.readyState ==4 && request.status == 200){
document.getElementById('textarea').innerHTML=request.responseText;
}
};
request.send(null);
}
var int=self.setInterval('init()', 3000);
</script>
I sincerely appreciate any help.
It was a URL issue. The logic is sound though.