js 解决传递url参数中文乱码问题

指向url:

url?ViewName=可研

  

获取js方法:

function getQueryString(key) {
    var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");
    var result = window.location.search.substr(1).match(reg);
    if (result != null) {
        return decodeURIComponent(result[2]);
    } else {
        return "";
    }
     
}
原文地址:https://www.cnblogs.com/LessIsMoreZ/p/9506197.html