1 什么是AJAX=HMTL+CSS+JS+DOM+XHR
1)传统Web应用是以请求->等待响应->请求->等待响应->....的过程,叫同步请求/操作2)现代Web应用是以请求->请求->请求->响应->响应->响应->...,叫异步请求/操作
3)现代Web应用以Ajax为主流,Ajax=C/S表面现象+B/S本质
<!DOCTYPE html> <html> <head> <Meta charset="UTF-8"> <title>ajax初体验</title> </head> <body> <div align="center"> <input type="button" id="btu" value="ajax体验" /> <hr /> </div> <script type="text/javascript"> var btuElement = document.getElementById("btu"); btuElement.onclick = function() { //alert("a"); var xhr = createXHR(); window.alert(xhr != null); } function createXHR() { //是ie if(window.ActiveXObject) { xhr = new ActiveXObject("microsoft.xmlhttp"); } //非ie else { xhr = new XMLHttpRequest(); } return xhr; } </script> </body> </html>