【发布时间】:2014-05-03 06:30:44
【问题描述】:
我有一个带有 target="_blank" 的表单,并在提交后重定向到新选项卡中的 url。 但问题是当前页面完全重新加载,然后重定向到新页面。 我无法弄清楚我错在哪里。
function postToUrl(path, params, method) {
//alert("This will take you to bill desk for payment. After payment bill desk will return you back to the portal.");
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "msg");
hiddenField.setAttribute("id", "msg");
hiddenField.setAttribute("value", params);
form.appendChild(hiddenField);
document.body.appendChild(form);
form.submit();
}
这是我用来提交的 javascript 函数。 我所做的是,我在按钮单击事件的代码隐藏中调用此 javascript 函数并传递参数。
对此有什么可能的解决方案?
【问题讨论】:
标签: c# javascript asp.net forms