获取 链接url参数

#获取 链接url参数
##js代码

//https://mp.csdn.net/mdeditor?type=hi&id=1
$.getUrlParam = function (name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURI(r[2]); return null;
    }
    var type = $.getUrlParam('type');  //hi
    var id = $.getUrlParam('id');   //1

猜你喜欢

转载自blog.csdn.net/weixin_42575028/article/details/86610438