post提交表单
function postExcelFile(params, url) { //params是post请求需要的参数,url是请求url地址 var form = document.createElement("form"); form.style.display = 'none'; form.action = url; form.method = "post"; document.body.appendChild(form); for(var key in params){ var input = document.createElement("input"); input.type = "hidden"; input.name = key; input.value = params[key]; form.appendChild(input); } form.submit(); form.remove(); }
请爱好前端技术的朋友,联系我,有问题大家一起讨论