【HTML】
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>jQuery Sample</title>
<link rel="stylesheet" href="css/main.css" type="text/css" media="all">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</head>
<body>
<h1>jQueryサンプル</h1>
<p>非同期通信の処理</p>
</body>
</html>
【CSS】
h1 {
font-size:14pt;
border-bottom:1px dotted gray;
width:320px;
}
div {
width:320px;
background-color:yellow;
border:1px solid red;
}
【JavaScript】
$(function(){
var httpObj = jQuery.get("./news.txt",null, function(){
alert(httpObj.responseText);
});
});
【HTML】
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>jQuery Sample</title>
<link rel="stylesheet" href="css/main.css" type="text/css" media="all">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</head>
<body>
<h1>jQueryサンプル</h1>
<p>非同期通信の処理</p>
</body>
</html>
【CSS】
h1 {
font-size:14pt;
border-bottom:1px dotted gray;
width:320px;
}
【JavaScript】
$(function(){
jQuery.ajax({
url : "./news.txt",
type : "get",
success : function(data){
alert(data);
}
});
});