Mysql xmlhttp.open获取无效字符
我认为改变口音会让人觉得有趣Mysql xmlhttp.open获取无效字符,mysql,xmlhttprequest,Mysql,Xmlhttprequest,我认为改变口音会让人觉得有趣 $GLOBALS['normalizeChars'] = array( 'Á'=>'Á', 'É'=>'É', 'Í'=>'Í', 'Ó'=>'Ó', 'Ú'=>'Ú', 'Ñ'=>'Ñ', 'á'=>'á', 'é'=>'é',
$GLOBALS['normalizeChars'] = array(
'Á'=>'Á', 'É'=>'É', 'Í'=>'Í', 'Ó'=>'Ó', 'Ú'=>'Ú', 'Ñ'=>'Ñ',
'á'=>'á', 'é'=>'é', 'í'=>'í', 'ó'=>'ó', 'ú'=>'ú', 'ñ'=>'ñ'
);
这个函数
function MakeIt($toClean){
return strtr($toClean, $GLOBALS['normalizeChars']);
}
。。。将帮助我将úúñ替换为á代码>等
但我还是有麻烦
mainfile.php调用get_data.php来读取使用MakeIt()的mySQL内容代码>以替换无效字符。如果我将get_data.php加载到浏览器中,字符将被正确替换,但从mainfile.php加载时返回无效字符
mainfile.php
函数ShowData(str)
{
如果(str==“”)
{
document.getElementById(“deal_rcpt”).innerHTML=“”;
回来
}
if(window.XMLHttpRequest)
{//IE7+、Firefox、Chrome、Opera、Safari的代码
xmlhttp=新的XMLHttpRequest();
}
其他的
{//IE6、IE5的代码
xmlhttp=新的ActiveXObject(“Microsoft.xmlhttp”);
}
xmlhttp.onreadystatechange=函数()
{
if(xmlhttp.readyState==4&&xmlhttp.status==200)
{
document.getElementById(“deal_rcpt”).innerHTML=xmlhttp.responseText;
}
}
open(“GET”,“GET_data.php?event=“+str,true”);
xmlhttp.send();
}
ShowData(1)
我认为xmlhttp与áèíóúñchars不兼容
<script>
function ShowData(str)
{
if (str=="")
{
document.getElementById("deal_rcpt").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("deal_rcpt").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","get_data.php?event="+str,true);
xmlhttp.send();
}
ShowData(1)
</script>
<div id="deal_rcpt"></div>