如何使用发布数据重定向?
如何移动到新页面$_POST?
这该怎么做?它是如何完成的,为什么要这样做呢
我正在尝试通过代码创建并提交表单.下面有什么问题?
$('#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) 我有一个属性的按钮data-url,并data-parameter和需要张贴到控制器。问题是,该控制器将返回一个重定向,所以$.post在这里并没有真正的帮助,我正在考虑动态创建表单并提交它。
我认为这是很常见的任务,但我在 jQuery 上找不到任何捷径来做到这一点,最短/最好的方法是什么?