[英]Submit form - cach after submited
I am trying to post the form from modal.我正在尝试从模态发布表单。 To keep the current page, I target post to the iFrame.
为了保留当前页面,我将帖子定位到 iFrame。
Which trigger is triggered after posting the form?发布表单后触发哪个触发器? Or any other solution to close modal after post?
或者在发布后关闭模式的任何其他解决方案? OnSubmit, as seen in the code, do not work.
如代码中所示,OnSubmit 不起作用。
<div class="modal-body">
<form method="post" id="modalForm" action="/Test/TestForm" target="myframe">
<input type="text" name="id" required />
<input type="text" name="name" required />
<input type="submit" value="Post" onsubmit="alert('after post - close modal!');" />
</form>
</div>
You can post form via Ajax
and get the begin and end request by using the following approach:您可以通过
Ajax
发布表单,并使用以下方法获取开始和结束请求:
<script>
$(document).ajaxStart(function () {
//display loading, etc.
});
$(document).ajaxComplete(function () {
//hide loading, etc.
});
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.