当前位置: 移动技术网 > IT编程>开发语言>.net > ASP生成JSON的问题

ASP生成JSON的问题

2018年09月13日  | 移动技术网IT编程  | 我要评论

hifi音乐,郑元畅林依晨吻戏,孕妇能吃杨梅吗

代码如下:
前台页面
$.getjson(“ajaxservice.?uid=” + escape(option.value) + “&r=” + math.random(), function (date) {
if (date.success == 0) {
validatesettings.succeed.run(option);
namestate = true;
} else {
validatesettings.error.run(option, option.prompts.error.beused.replace(“{1}”, option.value));
namestate = false;
}
})

后台
<%@language=”vbscript” codepage=”65001′%>
<!–#include file=”json_2.0.4.asp”–>
<!–#include file=”conn.asp”–>
<%
response.charset=”utf-8′
dim data,uname
dim rs,sql
uname=request.querystring(“uid”)
uname=vbsunescape(uname)
set data = jsobject()
set rs=server.createobject(“adodb.recordset”)
sql=”selse * from table where field =’”&uname&”‘”
if rs.eof and rs.bof then
data(“success”)= -1
else
data(“success”) = 0
end if
data.flush

function vbsunescape(str)
dim x
x=instr(str,”%”)
do while x>0
vbsunescape=vbsunescape&mid(str,1,x-1)
if lcase(mid(str,x+1,1))=”u” then
vbsunescape=vbsunescape&chrw(clng(“&h”&mid(str,x+2,4)))
str=mid(str,x+6)
else
vbsunescape=vbsunescape&chr(clng(“&h”&mid(str,x+1,2)))
str=mid(str,x+3)
end if
x=instr(str,”%”)
loop
vbsunescape=vbsunescape&str
end function
%>
利用firefox调试时候,后台返回乱码,何解呀?

每个asp文件最顶端加上:
<%@language=”vbscript” codepage=”65001′%>
<%response.codepage=65001%>
<%response.charset=”utf-8′%>
asp文件保存成utf-8格式,这样就不会有任何乱码问题了。

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网