AJAX is not a language, it is merely a manner in passing information between the server and the client using JavaScript and XML. This being said, you can't code in AJAX to do this. You need a server-side language (PHP, ASP.NET, JSP, etc.) to read the textfile and then output the data. JavaScript will then receive this text as the response text. Here is an example with PHP as the server-side language.

whatever.html
Code:
<html>
<body>

<script type="text/javascript">
var AJAX = {
  initialize: function(){
    var xmlHTTP;
    try{xmlHTTP = new XMLHttpRequest();}
    catch(e){
      try{xmlHTTP = new ActiveXObject("Msxml2.XMLHTTP");}
      catch(e){
        try{xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");}
        catch(e){
          alert("Your browser does not support AJAX!");
          return false;
        }
      }
    }
    return xmlHTTP;
  },

  get: function(url, func){
    var obj = this.initialize();
    obj.open('GET', url, true);
    obj.send(null);
    obj.onreadystatechange = function(){
      if(obj.readyState==4){
        func(obj.responseText);
      }
    }
  }
}

function parseFile(retText){
  document.getElementById('theDiv').innerHTML = retText;
}
</script>

<input type="button" value="Get File" onclick="AJAX.get('readfile.php', parseFile)">
<div id="theDiv"></div>

</body>
</html>
readfile.php
PHP Code:
<?php
$file 
'filename.txt';
$content = @file_get_contents($file);
if(
$content){
  echo 
$content;
}
?>