的HTML
<a href="#modal-2" role="button" class="btn" data-toggle="modal">Modal with animation</a>
<div id="modal-2" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary" id="book" >Save changes</button>
</div>
</div>
我已经使用了JS,但是没有结果
$('#book').click(function(e) {
$.ajax({
url: base_url+"admin/login/",
type: "get",
data: {Name:name, Mobile:mobile},
success: function( strData ){
//$('.modal, .modal-backdrop').hide();
$("#modal-2").modal('hide');
},
error: function(){
$('#report').text('Sorry, Please try again').css('color', 'red');
}
});
});
在这里,我想在单击保存按钮后在回调中调用ajax函数。
然后在ajax成功之后,我想关闭启动框弹出窗口
最佳答案
如果要使用BootBox,则可以执行以下操作:
bootbox.dialog({
message: "Your Message Here - You can pass in an HTML string",
title: "Your Title",
onEscape: function () {
bootbox.hideAll();
},
buttons: {
danger: {
label: "Cancel",
className: "btn default",
callback: function () {
bootbox.hideAll();
}
},
success: {
label: "Add",
className: "btn blue",
callback: function () {
//Add functionality here
// Then close the model using
bootbox.hideAll();
}
}
}
});
关于javascript - Bootstrap Bootbox单击保存按钮后删除弹出窗口,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21873203/