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 "";
    }
     
}

 

posted @ 2018-08-20 16:15  张追逐  阅读(183)  评论(0编辑  收藏  举报