当前位置:Gxlcms > asp.net > asp.net中在用ajax格式传递数据到aspx页面时出现乱码

asp.net中在用ajax格式传递数据到aspx页面时出现乱码

时间:2021-07-01 10:21:17 帮助过:24人阅读

 asp.net中在用ajax格式传递数据到aspx页面时有时会出现乱码,以下为解决方法

js中
代码如下:
  1. <br>XmlHttp.open("POST", "test.aspx", false); <br>XmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); <br>XmlHttp.send("QueryName=" + escape(Queryname) + "&QuerySex=" +escape(Querysex)); <br> <br><strong>在test.aspx中</strong>: <br><span><u></u></span> 代码如下:<pre class="brush:php;toolbar:false layui-box layui-code-view layui-code-notepad"><ol class="layui-code-ol"><li><br>string QueryName = HttpUtility.UrlDecode(Request.Params["QueryName"]); <br>string QuerySex = HttpUtility.UrlDecode(Request.Params["QuerySex"]); <br></li><li> </li><li> </li></ol></pre>

人气教程排行