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

AJAX簡歷系統(tǒng)附js文件

 更新時間:2007年08月16日 13:13:16   作者:  
復制代碼 代碼如下:

/**********************************************
 * @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 對象創(chuà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("正在逐個切換......");
                    }else if(readyStateTmp==4){
                        var statusTmp=a.status;
                        if(statusTmp==404){
                            obj._setMessage("未找到請求頁面!",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("未知錯誤!");
                        }
                    }else{
                        obj._setMessage("未知錯誤!");
                    }    
                }
            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;
     }
 }    

本地下載

相關文章

  • 關于Ajax中通過response在后臺傳遞數(shù)據(jù)問題

    關于Ajax中通過response在后臺傳遞數(shù)據(jù)問題

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

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

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

    Ajax寫分頁查詢(實現(xiàn)不刷新頁面)

    本文主要介紹了Ajax寫分頁查詢(實現(xiàn)不刷新頁面)的實例,具有很好的參考價值,下面跟著小編一起來看下吧
    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,但是這里這里通常不能傳遞特殊字符,比如說:“<”,本文就幫大家解決如何傳遞這種含特殊字符的數(shù)據(jù),感興趣的朋友一起看下吧
    2015-10-10
  • 按鈕的Ajax請求時一次點擊兩次提交的解決方法

    按鈕的Ajax請求時一次點擊兩次提交的解決方法

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

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

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

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

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

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

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

    IE8用ajax訪問不能每次都刷新的問題

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

最新評論