使用AJAX关闭Bootstrap的模态 [英] Close Bootstrap's modal with AJAX

查看:55
本文介绍了使用AJAX关闭Bootstrap的模态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Twitter的Bootstrap的模式.您可以通过单击按钮或带有标签 data-dismiss ="modal" 的其他按钮来关闭模式.我想用AJAX处理模式中的表单(通过单击提交按钮),然后关闭模式.那么如何在AJAX中关闭该模式呢?还是不可能?

I use the modal of Twitter's Bootstrap. You can close the modal, by clicking on a button or something different with the tag data-dismiss="modal". I would like to process my form in the modal with AJAX (by clicking on a submit button) and then close the modal. So how do close this modal in AJAX? Or is that not possible?

(对不起我的英语不好...)

(sorry for my bad English...)

推荐答案

如果您进一步阅读该文档,则:

If you read further down the documentation:

$('#myModal').modal('hide')

只需获取模态的ID,并用它替换 myModal .然后将其放置在AJAX成功处理程序中,就可以使用它.

Just get the ID of the modal, and replace myModal with it. Then place it in the AJAX success handler and there you have it.

这篇关于使用AJAX关闭Bootstrap的模态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆