gpt4 book ai didi

javascript - Bootstrap Bootbox 在单击保存按钮后删除弹出窗口

转载 作者:行者123 更新时间:2023-11-30 05:39:00 24 4
gpt4 key购买 nike

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>

我用了floowing 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 成功之后我想关闭 Bootstrap 框弹出窗口

最佳答案

如果你要使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com