jq代码如下:
window.onload=function (){ thisurl = document.location.href; thisarr = thisurl.split('='); thismid = thisarr[1]; if(thismid == "0611") { $.ajax({ type: "get", url: "../js/num.aspx", cache: false, data: "num=" + thismid+"&math=" + Math.random(), success: function(msg) { //alert("msg:"+msg); if (msg == "0") { alert("数据加载失败,请重新尝试或联系管理员."); }else { $("#zizhu").html(msg); } } }); }else { //alert("数字是"+thismid); }}
后台回传代码:
Response.Write(Server.UrlDecode(sb.ToString()));
问题描述:
后台获取相关数据,回传给jq代码,在ID为zizhu的div中显示数据,取出来的是图片列表+标题的列表,在vs调试时显示正常,放在服务器上就显示一串乱码,类似
??IJ??????Ƿ???10?????ת??ҳ...???已经尝试在web.config中添加字符编码转换,无效。不知道有没有什么办法解决,以前没有遇到过,希望大家指点下,谢谢。
4 回答
慕婉清6462132
TA贡献1804条经验 获得超2个赞
后台在用Response.Write()方法之前可以用Response.ContentType = "text/html;charset=gb2312"来设置返回值的编码,但是须与前台编码一致。
- 4 回答
- 0 关注
- 502 浏览
添加回答
举报
0/150
提交
取消