jq提交汉字后被URL编码,自动解码后乱码,是由于编码不统一与UTF-8模式文件存在,那么就得需要转换一下
在js中利用 escape 转一下编码
<script>
function DateDemos(id,guige)
{
$.get(“/sc/gouwuche/”, {
idss :id,
guige:escape(guige)
}, function (data){
if (data==0)
{
location.href = ‘/sc/gouwuche/’;
}
if (data==1)
{
location.href = ‘/sc/gouwuche/’;
}
if (data==2)
{
alert(“请登录!”);location.href = ‘/login/login.htm’;
}
if (data==3)
{
alert(“加入购物车失败!”);
}
});
}
</script>
在接收参数页面比如asp页面进行解码即可
<%Function vbsUnEscape(str)
dim i,s,c
s=””
For i=1 to Len(str)
c=Mid(str,i,1)
If Mid(str,i,2)=”%u” and i<=Len(str)-5 Then
If IsNumeric(“&H” & Mid(str,i+2,4)) Then
s = s & CHRW(CInt(“&H” & Mid(str,i+2,4)))
i = i+5
Else
s = s & c
End If
ElseIf c=”%” and i<=Len(str)-2 Then
If IsNumeric(“&H” & Mid(str,i+1,2)) Then
s = s & CHRW(CInt(“&H” & Mid(str,i+1,2)))
i = i+2
Else
s = s & c
End If
Else
s = s & c
End If
Next
vbsUnEscape = s
End Function
guige=vbsUnEscape(request(“guige”))
%>
评论前必须登录!
注册