js代码
var oHttpReq=new ActiveXObject("Microsoft.XMLHTTP");//MSXML2.XMLHTTP
var odoc=new ActiveXObject("MSXML2.DOMDocument");
var state=document.getElementById("studycar").value;//studycar 是个dropdownlist
//alert("state"+state);
oHttpReq.open("POST","xml_drop.aspx?studycar="+state,false);
oHttpReq.send("");
result=oHttpReq.responseText;
odoc.loadXML(result);
alert(result);//返回的 result是个xml 这里显示的 我的中文是乱码 有什么解决办法吗?xml_drop.aspx代码 string state = this.Request.QueryString["studycar"].Trim();
classkind ck = new classkind();
DataSet ds = new DataSet();
DataTable dt = ck.GetClassKind(" and classtype='" + state + "'");
ds.Tables.Add(dt);
XmlTextWriter w = new XmlTextWriter(this.Response.OutputStream, Response.ContentEncoding);
w.Formatting = Formatting.Indented;
w.Indentation = 4;
w.IndentChar = ' ';
ds.WriteXml(w);
w.Flush();
this.Response.End();
w.Close();
var oHttpReq=new ActiveXObject("Microsoft.XMLHTTP");//MSXML2.XMLHTTP
var odoc=new ActiveXObject("MSXML2.DOMDocument");
var state=document.getElementById("studycar").value;//studycar 是个dropdownlist
//alert("state"+state);
oHttpReq.open("POST","xml_drop.aspx?studycar="+state,false);
oHttpReq.send("");
result=oHttpReq.responseText;
odoc.loadXML(result);
alert(result);//返回的 result是个xml 这里显示的 我的中文是乱码 有什么解决办法吗?xml_drop.aspx代码 string state = this.Request.QueryString["studycar"].Trim();
classkind ck = new classkind();
DataSet ds = new DataSet();
DataTable dt = ck.GetClassKind(" and classtype='" + state + "'");
ds.Tables.Add(dt);
XmlTextWriter w = new XmlTextWriter(this.Response.OutputStream, Response.ContentEncoding);
w.Formatting = Formatting.Indented;
w.Indentation = 4;
w.IndentChar = ' ';
ds.WriteXml(w);
w.Flush();
this.Response.End();
w.Close();
Response.ContentType = "text/html"; //设置输出的格式为html
if (CmfuConfig.Instance.AppSetting.IsBig5)
{
Response.Charset = "UTF-8"; //设置输出的编码为UTF-8
}
else
{
Response.Charset = "gb2312";
}
Response.ContentType = "text/html"; //设置输出的格式为html
Response.Charset = "UTF-8"; //设置输出的编码为UTF-8
//Response.Charset = "gb2312";
根据相应选择
请问这是什么?