url中传参数为中文的转码与解码解决方法

1.转码   

中文为 “你好” 
var ProjectName = encodeURI(encodeURI(“你好”));,如下图所示 

《url中传参数为中文的转码与解码解决方法》

跳转页面  window.location.href=”/ProjectManagement/ProjectManagement/ViewProjectsDetails?ProjectName=” + ProjectName;

2.解码

获取ProjectName

var ProjectName = $.request(“ProjectName”));

 var aa =  decodeURI(ProjectName );

console.log(aa);   //你好

 

转载于:https://www.cnblogs.com/quitpoison/p/10973065.html

    原文作者:baodaotui4761
    原文地址: https://blog.csdn.net/baodaotui4761/article/details/101626793
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞