ajax请求
var xmlhttp;
var data;
//Mozilla ,chmore浏览器(将XMLHttpRequest对象作为本地浏览器对象来创建)
if(window.XMLHttpRequest){ //Mozilla 浏览器
xmlhttp = new XMLHttpRequest();
}else if(window.ActiveXObject) { //IE浏览器
//IE浏览器(将XMLHttpRequest对象作为ActiveX对象来创建)
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){}
}
}
var Url = "http://ip.taobao.com/service/getIpInfo.php?ip=220.181.134.224";
xmlhttp.open("GET", Url, true);
xmlhttp.onreadystatechange = result;
xmlhttp.send(data);
function result(){
if (xmlhttp.readyState == 4) {
var response = xmlhttp.responseText;
alert(response);
}
}