我正在尝试通过代码创建并提交表单.下面有什么问题?
$('#btnPrintInvoicePerFile').on('click', function (event) {
event.preventDefault(); //stop link default
var componentInvoiceId = EberlsComponentInvoiceForm.componentInvoice.Id;
console.log(componentInvoiceId);
$('<form>', {
"id": "getInvoiceImage",
"html": '<input type="text" id="componentInvoicId" name="componentInvoicId" value="' + componentInvoiceId + '" />',
"action": window.siteRoot + 'ComponentInvoice/GetInvoiceImage/'
}).submit();
});
Run Code Online (Sandbox Code Playgroud)
Cor*_*liu 29
尝试首先将表单附加到body元素:
$('<form>', {
"id": "getInvoiceImage",
"html": '<input type="text" id="componentInvoicId" name="componentInvoicId" value="' + componentInvoiceId + '" />',
"action": window.siteRoot + 'ComponentInvoice/GetInvoiceImage/'
}).appendTo(document.body).submit();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
28276 次 |
| 最近记录: |