创建XMLHttpRequest对象
XMLHttpRequest是AJAX的基础。
所有现代浏览器(IE7+、Firefox、Chrome、Safari以及Opera)均内建XMLHttpRequest对象。
注:IE5/IE6需要使用ActiveRequest对象。
向服务器发送请求
xmlhttp.open(“GET”,”ajax_info.txt”,true);
xmlhttp.send();
post方式:xmlhttp.send(“id=1&name=xiaoming”);
post提交方式,必须将Content-Type请求消息头更改为 application/x-www