resin在新版本中竟开始支持php了,文件有三个,一个是htm,一个是php,一个是js,js用在htm中,php为服务端。下面学步园小编来讲解下php_xmlhttp乱码问题怎样解决?
php_xmlhttp乱码问题怎样解决
a.js
functiongetXMLHTTPRequest(){
varxmlHttp;
if(window.ActiveXObject){
try{
xmlHttp=newActiveXObject("MSXML2.XMLHTTP");
}catch(e){
try{
xmlHttp=newActiveXObject("Microsoft.XMLHTTP");
}catch(e){
xmlHttp=false;
}
}
php_xmlhttp乱码问题怎样解决
}else{
try{
xmlHttp=newXMLHttpRequest();
}catch(e){
xmlHttp=false;
}
}
if(!xmlHttp){
returnfalse;
}else{
returnxmlHttp;
}
}
functionAjax(){
this.url;
this.params="";
this.parseParameters=function(thisform){
for(vari=0;i
vare=thisform.elements[i];
this.params+=(e.name+"="+e.value);
if(i!=(thisform.elements.length-1))
this.params+="&";
}
};
AjaxObj=getXMLHTTPRequest();
AjaxObj.onreadystatechange=processRequest;
this.post=function(){
AjaxObj.open("post",this.url,true);
AjaxObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset=utf-8');
if(this.params.length>0)
AjaxObj.send(this.params);
else
AjaxObj.send();
}
}
functionprocessRequest(){
if(AjaxObj.readyState==4){
if(AjaxObj.status==200){
if(AjaxObj.responseText!=""){
document.getElementById("show").innerHTML="";
document.getElementById("show").innerHTML=AjaxObj.responseText;
}
}else{
alert("Exception.");
}
}else{
document.getElementById("show").innerHTML="Loading......";
}
}
以上就是关于“php_xmlhttp乱码问题怎样解决”的内容,希望对大家有用。更多资讯请关注学步园。学步园,您学习IT技术的优质平台!