您的位置:首页 > 其它

window.location.href传递汉字参数

2017-02-08 16:55 351 查看
前台传递参数:

window.location.href = GetPageName() + "?category_id=" + _category_id + "&recommend=" + _recommend + "&word=" + encodeURI(encodeURI(_word));

word是中文,客户端编码两次,服务端解码一次

C#代码:

_word = HttpUtility.UrlDecode(Request["word"], System.Text.Encoding.UTF8);

前台获取uri字符串需解码:

_word = GetQueryString("word") == null ? "" : GetQueryString("word");

$("#text_query").val(decodeURI(_word));

原文来自:点击打开链接
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: