我是jquery的新手,对于简单的问题感到抱歉。我想提出其中有两个提交按钮形式...jquery表单在新窗口中提交
<input id="submitBtn" name="action" value="view" type="submit" class="ym-button ym-primary" value="<spring:message code="button.view"/>" title="<spring:message code="button.view" />" />
<input id="saveBtn" name="action" value="save" type="submit" class="ym-button ym-warning" value="<spring:message code="button.save"/>" title="<spring:message code="button.save" />" />
正如你可以看到我有一个名为submitBtn和saveBtn按钮。 submitBtn返回html,而saveBtn返回一个pdf。
当submitBtn命中时,我希望表单能够正常提交并在当前窗口中有响应加载。但是,当saveBtn命中时,我希望当前窗口保持不变,并将pdf加载到新的弹出窗口中。
到目前为止,我已经试过......
$("#submitBtn").click(function(){
if ($("form[name='shortsAndOversDailyForm']").valid()) {
return true;
}
return false;
});
$("#saveBtn").click(function(){
if ($("form[name='shortsAndOversDailyForm']").valid()) {
// specify a unique target name
var target = 'windowFormTarget';
// open a new window and name it
window.open('', target, 'width=1400,height=900');
// set the target of the form to be
// the window name
this.setAttribute('target', target);
// allow the form to be submitted normally
return true;
}
return false;
});
这样做的问题是,当我打的保存按钮,它会打开一个新的窗口,没有内容和PDF在窗口装在窗体已提交。
有人可以帮助解决这个问题,所以我可以把pdf加载到弹出窗口中吗?
感谢
你是如何genereting的PDF? – Yani
是的..请指出或解释您使用什么或如何为我们生成PDF以帮助您。 – Marc