Code:
<html>
<body>
<script type="javascript/text">
var a = new XMLHttpRequest( );
a.onreadystatechange = function( )
{
document.getElementById( "A" ).innerHTML = a.responseText;
}
a.open( "GET", "somefile.txt", true );
a.send( );
</script>
<div id="A">
The server hasn't processed your file request yet...
</div>
</body>
</html>
the readystatechange callback allows for you to hook the browser event for when the Javascript request is returned by the server...
the open function allows you to control what the request type is, the page (or file) to GET and the true designates this request
is asynchronous (meaning it will be processed by the browser in the background...
document.getElementById allows you to return a Javascript object representing the divider element "A" which then gives us the
ability to edit its "HTML", using the .innerHTML attribute...