想知道什么时候ajax请求全部完成
ajax可能会向后台发送多个请求,因为不知道它们个别都什么时候完成,所以不知道是不是页面确实数据已经加载完毕,想知道最后一个请求时什么时候完成的。现在我用了代理去替换httpxmlrequest这个对象,并将这段代码注入到网页里,但问题是不知道页面什么时候数据加载完成,现在是httpxmlrequest对象代理,但只能知道一次完成。[code=JScript][/code]function ajaxInfo1() {
     this.xmlHttpRequest = null;  	//保存XMLHttpRequest请求对象
     var objXMLHttp;
     if (window.XMLHttpRequest) {
         objXMLHttp = new XMLHttpRequest();
         this.xmlHttpRequest = createXMLHttpRequestAgent(objXMLHttp);
     }
}
//构造过程拦截
function createXMLHttpRequestAgent(ao) {
     document.write("构造过程拦截123start  ");
     document.write("123 ");
     agent = new Object;
     document.write("1 agent ");
     agent.xmlHttpRequest = ao; //被包裹的内核,是真正的通信对象
     agent.syncAttribute = function () { //syncAttribute是用来同步属性的	
         try {
             document.write("同步开始 ");
             this.readyState = this.xmlHttpRequest.readyState;
             this.responseText = this.xmlHttpRequest.responseText;
             this.responseXML = this.xmlHttpRequest.responseXML;
             this.status = this.xmlHttpRequest.status; //服务器状态
             this.statusText = this.xmlHttpRequest.statusText; //http状态的对应文本
             //this.onreadystatechange = this.xmlHttpRequest.onreadystatechange;
             document.write("同步结束 ");
         } catch (e) { }
     };
     agent.trigStateChange = function () { //模拟onreadystatechange
         agent.syncAttribute();
         switch (this.readyState) {
             case 0:
                 document.write("未初始化!  ");
                 break;
             case 1:
                 document.write("开始向服务器发送请求,载入!  ");
                 break;
             case 2:
                 document.write("载入完成!  ");
                 break;
             case 3:
                 document.write("交互,正在解析响应内容!  ");
                 break;
             case 4:
                 if (this.status == 200) {
                     document.write("与服务器交互完成调用!  ");
                 }
                 break;
             default:
                 alert("出界");
                 break;
         }
         if (agent.onreadystatechange != null) {
             agent.onreadystatechange();
         }
     };
     agent.xmlHttpRequest.onreadystatechange = agent.trigStateChange;
     agent.abort = function () { //模拟abort
         this.xmlHttpRequest.abort();
         this.syncAttribute();
     };
     agent.getAllResponseHeaders = function () { //模拟内核对应的方法
         var result = this.xmlHttpRequest.getAllResponseHeaders();
         this.syncAttribute();
         return result;
     };
     agent.getResponseHeader = function (headerLabel) { //模拟内核对应的方法
         var result = this.xmlHttpRequest.getResponseHeader(headerLabel);
         this.syncAttribute();
         return result;
     };
     agent.open = function (method, url, asyncFlag, userName, password) {          
         this.xmlHttpRequest.open(method, url, asyncFlag, userName, password);
         this.syncAttribute();
     };
     agent.send = function (content) { //模拟内核对应的方法
         this.xmlHttpRequest.send(content);
         this.syncAttribute();
     };
     agen