// 使用form表单实现post方式文件下载 downloadPost: function(url, data){ var body = document.getElementsByTagName('body')[0]; var form = document.createElement('form'); form.method = 'POST'; form.action = url; form.target = "blank"; for(var key in data){ var param = document.createElement('input'); param.type = "hidden"; param.name = key; param.value = data[key]; form.appendChild(param); } body.appendChild(form); form.submit(); body.removeChild(form); }
标签:body,key,form,JavaScript,param,表单,提交,var,document From: https://www.cnblogs.com/chenss15060100790/p/17335392.html