js 模拟 post

js 模拟 post 提交

        //js 模拟创建一张表
                var target = '_blank';
                var tempForm = document.createElement("form");
                tempForm.id = "tempForm1";
                tempForm.method = "post";
                tempForm.action = '<?php echo $HTTP_URL;?>capture';
                tempForm.target = target;
        
        //添加表元素
var authkeyInput = document.createElement("input"); authkeyInput.type = "hidden"; authkeyInput.name = 'authkey'; authkeyInput.value = 'XX'; tempForm.appendChild(authkeyInput); var libInput = document.createElement("input"); libInput.type = "hidden"; libInput.name = 'lib'; libInput.value = 'serverControl'; tempForm.appendChild(libInput);

        //添加表
        document.body.appendChild(tempForm);
                
                tempForm.submit();
                document.body.removeChild(tempForm);

 

 

 其他:http://www.360doc.com/content/12/0731/14/9629506_227464533.shtml

 

posted @ 2014-03-27 11:28  苏梳  阅读(206)  评论(0编辑  收藏  举报