加入收藏 | 设为首页 | 会员中心 | 我要投稿 驾考网 (https://www.jiakaowang.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 教程 > 正文

js post提交调用方法介绍

发布时间:2023-10-10 15:11:22 所属栏目:教程 来源:
导读:代码如下:

function post(URL, PARAMS) {

var temp = document.createElement("form");

temp.action = URL;

temp.method = "post";

temp.style.display = "none";

for (var x in PARAMS) {
代码如下:
 
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();
 
}
 
//调用方法 如
 
post('pages/statisticsJsp/excel.action', {html :prnhtml,cm1:'sdsddsd',cm2:'haha'});
 
 

(编辑:驾考网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章