欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時(shí)間:2007年08月16日 13:13:16   作者:  
復(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)讀取過(guò)!");
                    }else if(readyStateTmp==3){
                        obj._setMessage("正在逐個(gè)切換......");
                    }else if(readyStateTmp==4){
                        var statusTmp=a.status;
                        if(statusTmp==404){
                            obj._setMessage("未找到請(qǐng)求頁(yè)面!",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;
     }
 }    

本地下載

相關(guān)文章

  • 關(guān)于Ajax中通過(guò)response在后臺(tái)傳遞數(shù)據(jù)問(wèn)題

    關(guān)于Ajax中通過(guò)response在后臺(tái)傳遞數(shù)據(jù)問(wèn)題

    這篇文章給大家介紹了Ajax中通過(guò)response在后臺(tái)傳遞數(shù)據(jù)問(wèn)題,需要的的朋友參考下吧
    2017-08-08
  • JQuery中$.ajax()方法參數(shù)詳解

    JQuery中$.ajax()方法參數(shù)詳解

    AJAX即“Asynchronous Javascript And XML”(異步JavaScript和XML),是指一種創(chuàng)建交互式網(wǎng)頁(yè)應(yīng)用的網(wǎng)頁(yè)開(kāi)發(fā)技術(shù)。本文跟大家介紹JQuery中$.ajax()方法參數(shù)詳解,小伙伴們一起學(xué)習(xí)吧
    2015-10-10
  • Ajax寫(xiě)分頁(yè)查詢(實(shí)現(xiàn)不刷新頁(yè)面)

    Ajax寫(xiě)分頁(yè)查詢(實(shí)現(xiàn)不刷新頁(yè)面)

    本文主要介紹了Ajax寫(xiě)分頁(yè)查詢(實(shí)現(xiàn)不刷新頁(yè)面)的實(shí)例,具有很好的參考價(jià)值,下面跟著小編一起來(lái)看下吧
    2017-03-03
  • ajax.js里面有內(nèi)容顯示效果,根據(jù)ID

    ajax.js里面有內(nèi)容顯示效果,根據(jù)ID

    ajax.js里面有內(nèi)容顯示效果,根據(jù)ID...
    2006-10-10
  • 如何利用jQuery post傳遞含特殊字符的數(shù)據(jù)

    如何利用jQuery post傳遞含特殊字符的數(shù)據(jù)

    在jquery中,解決數(shù)據(jù)傳遞處理的方法我們通常利用$.ajax或$.post,但是這里這里通常不能傳遞特殊字符,比如說(shuō):“<”,本文就幫大家解決如何傳遞這種含特殊字符的數(shù)據(jù),感興趣的朋友一起看下吧
    2015-10-10
  • 按鈕的Ajax請(qǐng)求時(shí)一次點(diǎn)擊兩次提交的解決方法

    按鈕的Ajax請(qǐng)求時(shí)一次點(diǎn)擊兩次提交的解決方法

    像ajax請(qǐng)求發(fā)生兩次提交的原因是在執(zhí)行完ajax請(qǐng)求后,并沒(méi)有阻止submit的行為,下面小編給大家?guī)?lái)兩種按鈕的ajax請(qǐng)求時(shí)一次點(diǎn)擊兩次提交的解決方法,一起看看吧
    2016-09-09
  • Ajax提交Form表單及文件上傳的實(shí)例代碼

    Ajax提交Form表單及文件上傳的實(shí)例代碼

    前段時(shí)間在做程序的時(shí)候發(fā)現(xiàn)一個(gè)小問(wèn)題,在寫(xiě)后臺(tái)管理上傳圖片時(shí),在我進(jìn)行用Form表單提交的時(shí)候直接跳出來(lái)提交返回值的頁(yè)面并且原先的頁(yè)面刷新,下面小編通過(guò)分享本文給大家解析下
    2016-10-10
  • 原生Ajax之全面了解xhr的概念與使用

    原生Ajax之全面了解xhr的概念與使用

    AJAX 是與服務(wù)器交換數(shù)據(jù)并更新部分網(wǎng)頁(yè)的藝術(shù),在不重新加載整個(gè)頁(yè)面的情況下,通過(guò)在后臺(tái)與服務(wù)器進(jìn)行少量數(shù)據(jù)交換,AJAX 可以使網(wǎng)頁(yè)實(shí)現(xiàn)異步更新,下面這篇文章主要給大家介紹了關(guān)于原生Ajax之全面了解xhr的概念與使用的相關(guān)資料,需要的朋友可以參考下
    2022-11-11
  • ajax局部刷新一個(gè)div下jsp內(nèi)容的方法

    ajax局部刷新一個(gè)div下jsp內(nèi)容的方法

    局部刷新某個(gè)div下的jsp可以通過(guò)setInterval或者是setTimeout來(lái)輕松實(shí)現(xiàn),具體如下,有此需求的朋友可以參考下,希望對(duì)大家有所幫助
    2013-08-08
  • IE8用ajax訪問(wèn)不能每次都刷新的問(wèn)題

    IE8用ajax訪問(wèn)不能每次都刷新的問(wèn)題

    這篇文章主要介紹了IE8用ajax訪問(wèn)不能每次都刷新的問(wèn)題 的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2016-07-07

最新評(píng)論