var keyword = encodeURIComponent($("#search").val());
var url = "@Url.Action("SearchResult")" + "?name=" + keyword;
window.location = url;
You have three options:
escape() will not encode: @*/+
encodeURI() will not encode: ~!@#$&*()=:/,;?+'
encodeURIComponent() will not encode: ~!*()'
本文介绍了三种不同的URL编码方式:escape(), encodeURI(), 和 encodeURIComponent()。详细解释了每种方法不进行编码的字符集,并通过示例代码展示了如何使用这些方法来处理URL中的参数。
3887

被折叠的 条评论
为什么被折叠?



