jquery快速获得url 的get传值

<script>
var res = location.search.substr(1).split("&");
var arr={};
for (var i in res){
    //参数值中含有的中文要先解码,否则会显示为 %E5%B0%8F%E6 的格式
    var para=decodeURI(res[i].split("=")[1]);//或使用 decodeURIComponent()方法
    arr[res[i].split("=")[0]]=para;
}
</script>

 

posted @ 2018-11-14 10:58  早上六点半遇见五月天  Views(1322)  Comments(0Edit  收藏  举报