Ajax

配起来nginx就可以学ajax了
ajax w3schools

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<title>天文望远镜</title>
</head>
<body>
<div id="demo">
<h1>XMLHttpRequest</h1>
<button type="button" onclick="loadDoc()">Change Content</button>
</div>
<script type="text/javascript">
function loadDoc(){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function(){
if(this.readyState == 4 && this.status == 200){
document.getElementById("demo").innerHTML = this.responseText;
}
};
xhttp.open("GET", "ajax_info.txt", true);
xhttp.send();
}
</script>
</body>
</html>