且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery/Javascript删除URL字符串中的重复参数

更新时间:2023-01-12 22:03:38

在纯javascript中,请尝试

in pure javascript, try

function getParameterByName(name) {

    var match = RegExp('[?&]' + name + '=([^&]*)')
                    .exec(window.location.search);

    return match && decodeURIComponent(match[1].replace(/\+/g, ' '));

}

参考

Reference

在jQuery中看到此插件

in jQuery see this plugin

当您获取所有查询字符串的数组,然后通过jQuery从数组中删除重复项时,请尝试 唯一 ,或查看此插件

when u get array of all query string then to remove duplicate from an array via jQuery try unique or see this plugin