Js post传值并跳转

 function Tiaozhuan()
        {
            var data = { "name": "北京" }
            post("Pro/Salary.aspx",data);
        }


        function post(URL, PARAMS) {
            
            var temp = document.createElement("form");
            temp.action = URL;
            temp.method = "post";
            temp.style.display = "none";
            for (var x in PARAMS) {
                var opt = document.createElement("textarea");
                opt.name = x;
                opt.value = PARAMS[x];
                temp.appendChild(opt);
            }
            document.body.appendChild(temp);
            temp.submit();
            return temp;
        }

 

posted @ 2018-11-05 14:55  唐尧  阅读(3011)  评论(0编辑  收藏  举报