XMLHttpRequest对象
<html >
<head><meta charset="UTF-8"></head>
<body>
<div id="block">
</div>
</body>
<script type="text/javascript">
var xmlHttp;
if(window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttp.onreadystatechange = function() {
if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
document.getElementById("block").innerHTML = xmlHttp.responseText;
}
}
xmlHttp.open("GET","demo.json",true);
xmlHttp.send();
</script>
</html>