首页 > 代码库 > js构建form进行post提交

js构建form进行post提交

//构建post方式提交
var form = document.createElement("form");
form.action = "conditionSearch.action";
form.method = "POST";
form.style.display = "none";
//构建input并附加参数
//查询条件
var conditionText = document.createElement("input");
conditionText.setAttribute("name", "${name}");
conditionText.setAttribute("type", "text");
conditionText.value="http://www.mamicode.com/${value}";

form.appendChild(conditionText);

document.body.appendChild(form);

form.submit();