サーバー上のテキストファイルを読み込む

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript"><!--
function loadTextFile(fName)
{
new Ajax.Request(fName, { method: "get", onComplete: displayData });
}
function displayData(httpObj)
{
$("resultData").innerHTML = httpObj.responseText;
}

// --></script>
</head>
<body>
<h1>サーバー上のテキストファイルを読み込む</h1>
<form>
<input type="button" value="data.txtファイル読み込み" onClick="loadTextFile('data.txt')">
</form>
<div id="resultData"></div>
</body>
</html>

・サンプルを実行する
Ajax逆引きクイックリファレンス 説明などは本書を参考にしてください。