js创建表单并提交

1.脚本

	Util = {
			post : function(URL, PARAMS){ //虚拟表单实现post提交
				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();        
			    return temp;   
			}
	};

  

2.调用

Util.post('${rc.contextPath}/eacCoreOuterAccounting/exportData', queryCond);

原文地址:https://www.cnblogs.com/yun965861480/p/6274467.html