我试图通过代码创建并提交表单。下面有什么问题?jQuery创建并动态提交表单
$('#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();
});
你可能想在jQuery的。员额http://api.jquery.com/jQuery.post/看看吧。这可能更接近你正在寻找的东西。 – 2013-02-12 16:05:11
“下面有什么问题?”我不知道,你有什么错误?什么不是你认为应该发生的事情? – j08691 2013-02-12 16:06:57