我的bootstrap(3.0.2)模式不会显示。我尝试了不同的按钮,链接和所有这些,但它根本不会出现。我感谢任何帮助!
<a onclick="open_popup('login');">lo</a>
<script>
function open_popup(popup) {
var data_str = 'popup=' + popup;
$.ajax({
type: "GET",
cache: false,
url: "exam.php",
data: data_str,
success: function() {}
});
};
</script>
<button data-toggle="modal" data-target="#login_pop" style="display:none"></button>
<div class="login_pop" id="login_pop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="login_modal-dialog">
<div class="modal-content">
<div class="modal-body"></div>
</div>
</div>
</div>
答案 0 :(得分:0)
您可以使用$("#login_pop").modal("show");
通过代码显示模式。请尝试以下代码。
<script>
function open_popup(popup) {
$("#login_pop").modal("show");
var data_str='popup='+popup;
$.ajax({ type:"GET", cache:false,
url:"exam.php",
data:data_str,
success:function(){ }
});
};
</script>
<a onclick="open_popup('login');">lo</a>
<div class="modal fade" id="login_pop" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="login_modal-dialog">
<div class="modal-content">
<div class="modal-body"> Hello world!! </div>
</div>
</div>
</div>
</div>