美文网首页
JS模拟form表提交

JS模拟form表提交

作者: 奈何138 | 来源:发表于2015-11-25 11:56 被阅读441次

//模拟form表提交

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

相关文章

网友评论

      本文标题:JS模拟form表提交

      本文链接:https://www.haomeiwen.com/subject/vuarhttx.html