1,XMLHttpRequest
2,window.ActioveXObject(ie浏览器)
3,new ActiveXObject(“Microsoft.XMLHTTP”)
4,window.XMLHttpRequest(除IE外)
5,new XMLHTTPRequest()
6,xmlHttpRequest.open("GET","AjaxServlet",true,);
7,回调函数:
xmlHttpRequest.onreadystatechange = ajaxCallback;
xmlHttpRequest.send(null);//null的话就是get,如果是正真的数据就是post
function ajaxCallback(){
xmlHttpRequest.readyState==4
xmlHttpRequest.status == 200
var responseText = xmlHttpRequest.responseText;
document.getElementById("div").innerHTML = responseText;
}
get+ajax:
post+ajax:
在send调用之前: