<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>AJAX load txt show webpage</title>
<script type="text/javascript" src="jquery.js"></script>
<script language="javascript">
$(document).ready( function() {
$('#d1').click( function() {
$('#showarea').load( 'data/1.txt' );
});
} );
</script>
</head>
檔名:test.html
準備一個txt檔案(有內文)
<body>
<h1>ajax load txt and show the webpage</h1>
<p><button id="d1">讀取一個文字檔</button></p>
<div id="showarea" style="background-color:#f7f7f7;">...初始未讀入資料...</div>
</body>
</html>
檔名:test.html