Js Post传参跳转新页面

    function JumpPost(){
    var data = { "id": "ids","name": "张三" }
    jspost("http://phpwebhome.com",data);
    }

    function jspost(URL, PARAMS) {

    var temp = document.createElement("form");
    temp.action = URL;
    temp.method = "post";
    temp.target = "_blank";
    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;
    }
    JumpPost();

    转载请注明:RAIN MAN » Js Post传参跳转新页面

    喜欢 1
标签: ,

还没有人抢沙发呢~