Skip to content

Commit 7649690

Browse files
committed
added source files
1 parent c73db91 commit 7649690

File tree

7 files changed

+971
-0
lines changed

7 files changed

+971
-0
lines changed

ajax.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<html>
2+
<head>
3+
<script type="text/javascript" src="json2.js"></script>
4+
<script type="text/javascript" src="ajax.js"></script>
5+
</head>
6+
<body>
7+
8+
<div id="myDiv"><h2>Let AJAX change this text</h2></div>
9+
<button type="button" onclick="loadXMLDoc()">Change Content</button>
10+
11+
</body>
12+
</html>

ajax.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function loadXMLDoc()
2+
{
3+
xmlhttp=new XMLHttpRequest();
4+
xmlhttp.onreadystatechange=function() {
5+
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
6+
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
7+
}
8+
}
9+
xmlhttp.open("POST","ajaxresponse",true);
10+
xmlhttp.send(JSON.stringify({update: {player: 1, field: [1,2,3]}}));
11+
}
12+

0 commit comments

Comments
 (0)