濮阳杆衣贸易有限公司

主頁 > 知識(shí)庫 > AJAX簡(jiǎn)歷系統(tǒng)附j(luò)s文件

AJAX簡(jiǎn)歷系統(tǒng)附j(luò)s文件

熱門標(biāo)簽:海南銀行智能外呼系統(tǒng)商家 電銷機(jī)器人違法了嗎 遼寧銀行智能外呼系統(tǒng) 澳大利亞城市地圖標(biāo)注 姜堰電銷機(jī)器人 上海浦東騰訊地圖標(biāo)注位置 遼寧正規(guī)電銷機(jī)器人 許昌智能電銷機(jī)器人公司 辰溪地圖標(biāo)注
復(fù)制代碼 代碼如下:

/**********************************************
 * @author        skyz
 * @function    javascript client ajax dealwith
 * @datetime    2006-3-20
 **********************************************    
 * Function: Create a httpRequest object
 **********************************************/ 
function HttpRequest(){
    this._httpRequest=null;                                    //HttpRequest request object
    this._callBack=null;                                    //Call back function
    this._domResult=true;                                    //Result if dom object or text string
    this._requestData=null;                                    //Request data
    this._requestResult=null;                                //HttpRequest result
    this._stateString=null;                                    //Current request state string
    this._error=false;                                        //Current if have error
    this._callBackPara=null;                                //Current callback function parama
    //internal method for get HttpRequestObject
    this.init=function(){
        //Judge if Not IE
        if(window.XMLHttpRequest){
            this._httpRequest=new XMLHttpRequest();
            //Set request mime is text/xml
            if(this._httpRequest.overrideMimeType){
                this._httpRequest.overrideMimeType('text/xml');
            }
        }else if(window.ActiveXObject){
            try{
                this._httpRequest=new ActiveXObject("Msxml2.XMLHTTP");
            }catch(ex){
                try{
                    this._httpRequest=new ActiveXObject("Microsoft.XMLHTTP");
                }catch(ex){
                    this._setMessage(ex,true);
                    return;
                }
            }
                // this._httpRequest.setrequestheader("Content-Type","text/xml;charset=gb2312");
        }
        //Judge HttpRequest object create successful
        if(!this._httpRequest){
            this._setMessage("XMLHttpRequest 對(duì)象創(chuàng)建失??!請(qǐng)重試......",true);
            return;
        }    
    }
    /*    
     * Function: Set the request header
     * namePar:request's header name
     * valuePar:request's header value
     */
    this.doSetRequestHeader=function(namePar,valuePar){
        if(this._error){
            return;
        }
        this._httpRequest.setRequestHeader(namePar,valuePar);
    }
    /*    
     * Function: Set the request data
     * dataPar:request's send data;
     */
    this.doSetRequestData=function(dataPar){
        if(this._error){
            return;
        }
        this._requestData=dataPar;
    }
    /*
     *Function get RequestHttp Object
    */
    this._getRequestObj=function(){
        if(this._error){
            return;
        }
        return this._httpRequest;
    }
    /*
     * Function:Set Callback function para
     */
    this.doSetCallBack=function(callBack,paraData){
        this._callBack=(callBack)?callBack:null;
        this._callBackPara=(paraData)?paraData:null;
    };
    /*
     * Function: Get current stateString
     */
    this.doGetState=function(){
        return this._stateString;
     }
     /*
     * Function: get current Error 
     */
    this.doGetError=function(){
        return this._error;
     }
     /*
      *
       */
    this.doCallBack=function(){
        this._callBack(this._requestResult,this._callBackPara);
    }

    /*    
     * Function: Send the request
     * urlPar: request's url path
     * [methodPar]:request's method
     * [domPar]: request's result is dom or string
     */
    this.doSendResuest=function(urlPar,methodPar,obj,domPar,asyPar){
        if(obj._error){
            return;
        }
        methodPar=((methodPar)?methodPar:"GET");
        asyPar=((asyPar)?asyPar:true);
        this._domResult=(domPar)?domPar:obj._domResult;
        try{
                var a=this._getRequestObj();
                a.onreadystatechange=function(){
                    if(obj._error){
                        return;
                    }
                    var readyStateTmp=a.readyState;
                    if(readyStateTmp==0){
                        obj._setMessage("未初始化!");
                    }else if(readyStateTmp==1){
                        obj._setMessage("正在讀取中......");
                    }else if(readyStateTmp==2){
                        obj._setMessage("已經(jīng)讀取過!");
                    }else if(readyStateTmp==3){
                        obj._setMessage("正在逐個(gè)切換......");
                    }else if(readyStateTmp==4){
                        var statusTmp=a.status;
                        if(statusTmp==404){
                            obj._setMessage("未找到請(qǐng)求頁面!",true);
                        }else if(window.location.href.indexOf("http")==-1 || statusTmp==200){
                            obj._setMessage("完成!");    
                            if(this._domResult  window.XMLHttpRequest){
                                obj._requestResult=a.responseXml;
                            }else{
                                obj._requestResult=a.responseText;
                            }
                            if(obj._callBack){
                                obj.doCallBack();
                            }
                        }else{
                            obj._setMessage("未知錯(cuò)誤!");
                        }
                    }else{
                        obj._setMessage("未知錯(cuò)誤!");
                    }    
                }
            a.open(methodPar,urlPar,asyPar);
            // a.setRequestHeader("If-Modified-Since","0");
            a.send(obj._requestData);
        }catch(ex){
            obj._setMessage(ex,true);
        }
    }
    /*
     * Function: Deal exception error 
     * exPar:error string
     */
    this._setMessage=function(exPar,mark){
        this._stateString=exPar.toString();
        this._error=(mark)?mark:false;
     }
 }    

本地下載
您可能感興趣的文章:
  • python簡(jiǎn)單實(shí)現(xiàn)刷新智聯(lián)簡(jiǎn)歷
  • 招聘網(wǎng)站基于jQuery實(shí)現(xiàn)自動(dòng)刷新簡(jiǎn)歷
  • 使用jQuery實(shí)現(xiàn)的網(wǎng)頁版的個(gè)人簡(jiǎn)歷(可換膚)
  • 比較啊強(qiáng)悍的求職簡(jiǎn)歷
  • 令老板當(dāng)場(chǎng)暈倒的兩份簡(jiǎn)歷
  • 個(gè)人簡(jiǎn)歷詞匯
  • 英文求職簡(jiǎn)歷范例
  • 女強(qiáng)人陳曉旭的比較完整的個(gè)人簡(jiǎn)歷
  • 可讀可執(zhí)行的C語言簡(jiǎn)歷源文件

標(biāo)簽:伊春 威海 撫州 晉城 西藏 銅川 崇左 深圳

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《AJAX簡(jiǎn)歷系統(tǒng)附j(luò)s文件》,本文關(guān)鍵詞  AJAX,簡(jiǎn)歷,系統(tǒng),附,文件,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《AJAX簡(jiǎn)歷系統(tǒng)附j(luò)s文件》相關(guān)的同類信息!
  • 本頁收集關(guān)于AJAX簡(jiǎn)歷系統(tǒng)附j(luò)s文件的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    安阳县| 九台市| 景东| 黔西| 台南市| 云林县| 毕节市| 通许县| 永吉县| 万全县| 马关县| 安仁县| 吴桥县| 若尔盖县| 武城县| 盐池县| 上犹县| 香格里拉县| 会理县| 大连市| 久治县| 土默特右旗| 东方市| 辛集市| 阿克苏市| 沧源| 和平区| 康乐县| 临武县| 泰兴市| 涞源县| 陆良县| 浮梁县| 崇阳县| 霍州市| 聂荣县| 龙海市| 盐津县| 定兴县| 远安县| 泾川县|