亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jquery ajax傳遞中文參數(shù)亂碼問題及解決方法說明

 更新時間:2014年02月07日 10:00:50   作者:  
本篇文章主要是對jquery ajax傳遞中文參數(shù)亂碼問題及解決方法進行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助

jQuery傳遞中文參數(shù)亂碼,原因是默認的傳遞方式?jīng)]有采用UTF-8,所有我們可以在傳遞參數(shù)的時候?qū)?shù)進行編碼,然后再操作,代碼如下,紅色的代碼為傳遞的參數(shù),已標(biāo)注

復(fù)制代碼 代碼如下:

smsubmitclick = function(){
   $(document).ready(function(){
       var name = $("#txt_name").val();
       var type = $("#seltype option:selected").val();
       var zjnum = $("#txt_num").val();
       if(name == null || name =="")
       {
           alert("請輸入您的真實姓名");
           return false;
       }
       if(name.length > 20)
       {
           alert("對不起,您的用戶名存在異常,請重新輸入");
           $("#txt_name").focus();
           $("#txt_name").val("");
           return false;
       }
       if(zjnum == null || zjnum == "")
       {
           alert("請輸入證件號碼");
           return false;
       }
       if(zjnum.length > 30)
       {
           alert("對不起,您的證件存在異常,請重新輸入");
           $("#txt_num").focus();
           $("#txt_num").val("");
           return false;
       }
       else
       {
            $.ajax({
                type:"get",
                cache:false,
                contentType:"application/x-www-form-urlencoded:charset=UTF-8",
                url:"ajaxpage.aspx?t=smrz&name="+escape(name)+"&zjtype="+escape(type)+"&zjnum="+escape(zjnum)+"",
                dataType:"json",
                success:function(data){
                    alert(data.info);
                }
            })
       }
   })

}

相關(guān)文章

最新評論