<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Jquery Ajax Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="./jquery-1.2.6.min.js"></script>
</head>
<body>
<button type="button" id="button1">取得</button>
<div id="result"></div>
<script type="text/javascript">
$('#button1').click( function(){
$.ajax({
url: 'text.txt',
type: 'GET',
dataType: 'text',
timeout: 1000,
error: function(){
$( "#result").html( "読み込み失敗");
},
success: function( getResult){
$( "#result").html( getResult);
}
});
});
</script>
</body>
</html>
jQuery: http://jquery.com/
Jquery1.2.6を使用した、Ajaxの超基本サンプル
2008年7月15日火曜日 by mikuta
登録:
コメントの投稿 (Atom)

0 コメント:
コメントを投稿