var xmlhttpget;
try {
// Firefox, Opera 8.0+, Safari
xmlhttpget = new window.XMLHttpRequest();
}
catch (e) {
// Internet Explorer
try {
//Internet Explorer 6.0+
xmlhttpget = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
//Internet Explorer 5.5+
xmlhttpget = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
alert("您的浏览器不支持AJAX!");
return;
}
}
}
xmlhttpget.open("GET", url, false);
xmlhttpget.send(null);
var ajaxResult = xmlhttpget.response == undefined ? xmlhttpget.responseText : xmlhttpget.response;
转载于:https://www.cnblogs.com/yumianhu/p/3710739.html