function ajax(){ //1.创建ajax对象 if(window.XMLHttpRequest){ oAjax=new XMLHttpRequest(); }else{ oAjax=new ActiveXObject("Microsoft.XMLHTTP"); } oAjax.open('GET',"./index.do", true); oAjax.setRequestHeader("Authorization",token); //设置请求头
oAjax.send(null); oAjax.onreadystatechange=function(){ "要执行的操作" }