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

ajax 中文问题

?参数中文

function ajax(param) {
?var myxml = new ActiveXObject("Microsoft.XMLHTTP");
?myxml.open("POST",encodeURI(encodeURI("../../public/ajax.jsp?param="+param)),false);
?myxml.send();
?var mytext = Bytes2Bstr(myxml.responseText);
?return mytext;
}
function query_only(sql) {
?var myxml = new ActiveXObject("Microsoft.XMLHTTP");?
?myxml.open("POST","../../public/query_only.jsp?sql="+escape(sql),false);
?myxml.send();
?var mytext = Bytes2Bstr(myxml.responseText);
?return mytext;
}

?

?

返回中文

?保证页面和首台都是utf -8? ,另外在后台 response.setContentType("text/xml;charset=utf-8"); 这样就行了。