隐藏GET请求URL参数

 function post(URL, PARAMS) {
        var temp_form = document.createElement("form");
        temp_form.action = URL;
        temp_form.target = "_blank";
        temp_form.method = "post";
        temp_form.style.display = "none";
        for (var x in PARAMS) {
            var opt = document.createElement("textarea");
            opt.name = x;
            opt.value = PARAMS[x];
            temp_form .appendChild(opt);
        }
        document.body.appendChild(temp_form);
        temp_form.submit();
}
调用示例:post(url,{'id':'123'});

 

posted @ 2019-03-22 16:32  嗑瓜子不吐皮  阅读(3486)  评论(0编辑  收藏  举报