js post提交

/*
js跳转页面
url跳转地址,params参数列表
*/
function Posturl(url,params){
//创建form表单
var temp_form=document.createElement('form');
//设置form各种属性
temp_form.action=url;
temp_form.method="post";
temp_form.target="_self";
temp_form.style.display="none";
//添加参数
for(var item in params){
var opt=document.createElement("textarea");
opt.name=params[item].name;
opt.value=params[item].value;

temp_form.appendChild(opt);
}
document.body.appendChild(temp_form);
//提交数据
temp_form.submit();

}
//Post跳转调用示例
function toReportDtl(BusinessCategory,BusinessPlate,CompanyIds,PeriodValueShow){
var parames=new Array();
parames.push({name:'businessCategory',value:BusinessCategory});
parames.push({name:'businessPlate',value:BusinessPlate});
parames.push({name:'companyIds',value:CompanyIds});
parames.push({name:'periodValue',value:PeriodValueShow});


Posturl("changPinChangLiang.html",parames);
return false;
}

原文地址:https://www.cnblogs.com/mili3/p/6018563.html