在js中使用这种方式提交form表单数据,地址栏中的地址会跟着改变,当再次刷新的时候还是会走此次请求。
var form = document.getElementById(formId);
form.action = _url;
form.submit();
而使用这种方式地址栏的地址不会改变
var form = document.getElementById(formId);
form.action = _url;
var oinput = document.createElement("input");
oinput.setAttribute('type', 'submit'); //定义类型是文本输入
oinput.setAttribute('id', 'bsubmit'); //定义类型是文本输入
document.getElementById(formId).appendChild(oinput );
$("#bsubmit").click();