1.AXJX的本质
AJAX = 异步 JavaScript 和 XML,AJAX 是一种用于创建快速动态网页的技术。
2.它的四大基本步骤
(1)创建 XMLHttpRequest 对象
var=new XMLHttpRequest();
var=new ActiveXObject("Microsoft.XMLHTTP");(老版本的Internet Explorer模式)
(2)服务器响应
responseText-获得字符串形式的响应数据。
responseXML-获得 XML 形式的响应数据。
(3)建立链接(数据的交互)
xhr.open("POST","demo_post.asp",true);
(4)向服务器发送请求
xhr.send();发送请求(数据的交互)
当xhr.open()中为true,则为异步,当flase时为同步。
3.AXJX
<html>
<body>
<div id="myDiv"><h3>Let AJAX change this text</h3></div>
<button type="button" onclick="loadXMLDoc()">Change Content</button>
</body>
</html>
<head>
<script type="text/javascript">
function loadXMLDoc()
{
.... AJAX script goes here ...
}
</script>
</head>
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。