<script>
var xhr;
//兼容浏览器
if(window.ActiveXObject){
xhr=new ActiveXObject("Microsoft.XMLHTTP");
}else {
xhr=new XMLHttpRequest();
}
//alert(xhr);
//1、打开链接
//请求方式 请求的地址 是否同异步
//注意:请求方式大写、地址一定要加http://
xhr.open("GET","http://192.168.15.222:8080/test/hello.action?name=yc",false);
//2、有数据则发数据,没有数据则null
xhr.send(null);
//3、得到相应
var text=xhr.responseText;
console.log(text);
</script>