【发布时间】:2015-12-05 16:20:24
【问题描述】:
我试图让这个表单在按下按钮而不刷新页面时关闭。然后其他人将放置在 Ajax 代码中。 这个表单是一个弹出窗口,所以弹出窗口需要关闭。目前我可以点击按钮而不刷新,但我需要关闭弹出框。 我发现了各种使用 Ajax 等的方法,但正如我所说的那样,在我可以关闭 Ajax 之后,其他人将放入 Ajax。 这是表单代码
<div id="contact_form">
<form role="form">
<div class="form-group">
<label for="rangeStart1">Range Start</label>
<input type="text" class="form-control" id="rangeStart3" placeholder="Range Start">
</div>
<div class="form-group">
<label for="rangeFinish1">Range Finish</label>
<input type="text" class="form-control" id="rangeFinish3" placeholder="Range Finish">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
这是函数(我在 Stackoverflow 上找到的)
function sendContactForm(){
$('#contactForm').submit(function () {
sendContactForm();
return false;
});
【问题讨论】:
-
好像错过了函数的关闭。
-
为什么是递归的?你在哪里调用函数?
-
为了更好理解,请提供工作演示(code sn-p,jsfiddle ...)