日期:2014-05-16  浏览次数:20742 次

AJAX POST 获取表单数据为乱码!
JScript code

function ShowArticle(){
var adminName=document.getElementById("adminName");
    adminName=escape(adminName.value);
var adminQuestion=document.getElementById("adminQuestion");
    adminQuestion=escape(adminQuestion.value);
var adminKey=document.getElementById("adminKey");
    adminKey=escape(adminKey.value);
var error=document.getElementById("check_main_error");
    CreateXMLHttpRequest();
    var parm = "adminName="+adminName+"&adminQuestion="+adminQuestion+"&adminKey="+adminKey;
    alert(parm);
//alert 如果表单中有中文 数据将是乱码: adminName=admin&adminQuestion=%u5012%u8428&adminKey=%u5012%u8428;
//alert 如果没有中文 输出正常;
    var url="index_forgetPS_save.php";
    xmlobj.open("POST",url,true);
    xmlobj.onreadystatechange = StatHandler;
    xmlobj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
    xmlobj.send(parm);
}



请高手帮忙解决

------解决方案--------------------
php中有urldecode函数,可以直接用,lz可以试下