亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        ajax提交大數(shù)據(jù)文章

        字號(hào):


            上面的ajax寫(xiě)的是GET方式提交的異步內(nèi)容,當(dāng)遇到大數(shù)據(jù)的情況下,會(huì)出現(xiàn)url超長(zhǎng),或者當(dāng)url的內(nèi)容出現(xiàn)“&”時(shí),則會(huì)按照url的鏈接符號(hào)傳輸,會(huì)出現(xiàn)截?cái)唷?BR>    下面是ajax用POST的形式進(jìn)行提交,在提交大數(shù)據(jù)的內(nèi)容出現(xiàn)"&",不會(huì)出現(xiàn)錯(cuò)誤或者數(shù)據(jù)截?cái)唷?BR>    function GetXmlHttpObject()
            {
              var xmlHttp=null;
              try{ // Firefox, Opera 8.0+, Safari
                xmlHttp=new XMLHttpRequest();
                }
              catch (e){
                // Internet Explorer
                try{
                  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
                  }catch (e){
                  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                  }
                }
              return xmlHttp;
            }
            function saveHint()
            { xmlHttp=GetXmlHttpObject()  
              if (xmlHttp==null){
                alert ("您的瀏覽器不支持AJAX!");
                return;
               }
            var url="forasp.cn.save.php";
            data="p="+encodeURIComponent(document.getElementById('v').value);//定義參數(shù)p 
            //主要是上面的這句 “encodeURIComponent”,設(shè)置將內(nèi)容進(jìn)行轉(zhuǎn)碼,這個(gè)非常重要。
            data=data+"&sid="+Math.random();//加上隨機(jī)碼,防止緩存
            xmlHttp.open("POST",url,true);
            xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
            xmlHttp.onreadystatechange=stateChanged;
            xmlHttp.send(data);//將數(shù)據(jù)進(jìn)行post提交
            }
            function stateChanged() 
            { 
              if (xmlHttp.readyState==4&&xmlHttp.status == 200)
              { 
              document.getElementById("v").value=xmlHttp.responseText;//獲取返回值,并給對(duì)象v
              }
            }
            接受頁(yè)面通過(guò)進(jìn)行傳統(tǒng)的接受即可,獲取前面的參數(shù)p
            比如php  $_POST['p']
            asp  request.form('p')
            這樣就可以完成大數(shù)據(jù)量的POST提交,并且能夠自動(dòng)轉(zhuǎn)碼進(jìn)行url的&號(hào)規(guī)避。