参考:http://book.youkuaiyun.com/bookfiles/11/10011443.shtml
创建XMLHttpRequest对象的一个实例

function callback() ...{

if (xmlHttp.readyState == 4) ...{

if (xmlHttp.status == 200) ...{
//do something interesting here
}
}
}

var xmlHttp;

function validateEmail() ...{
var email = document.getElementById("email");
var url = "validate?email=" + escape(email.value);

if (window.ActiveXObject) ...{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}

else if (window.XMLHttpRequest) ...{
xmlHttp = new XMLHttpRequest();
}
xmlHttp.open("GET", url);
xmlHttp.onreadystatechange = callback;
xmlHttp.send(null);
}

168

被折叠的 条评论
为什么被折叠?



