很多人会用js函数 window.open(),但这个函数只能GET提交,不能POST提交。在我们开发的过程中往往经常用POST提交。
解决这个问题的思路是:先用window.open()打开一个新的窗口,然后在表单中指定提交的target为刚刚打开的窗口即可。
例子代码:
<form name="query_notice_form" target="_blank"
action="<c:url value="/abc/xxxx.do"/>" method="post"><input
type="hidden" name="currType"></form>
function showNoticeDetail(obj) {
window.open('about:blank',"_blank","height=400,width=820,status=yes,toolbar=no,menubar=no,location=no");
query_notice_form.submit();
}