Ajax 引导4模式关闭按钮不工作首先打开
我有一个使用id的动态模式操作。代码工作得很好,但是关闭按钮只有在页面刷新时才能工作 使用Ajax dynamic的My js函数:Ajax 引导4模式关闭按钮不工作首先打开,ajax,modal-dialog,bootstrap-modal,Ajax,Modal Dialog,Bootstrap Modal,我有一个使用id的动态模式操作。代码工作得很好,但是关闭按钮只有在页面刷新时才能工作 使用Ajax dynamic的My js函数: function urlId() { //je récupère l'id de l'url $('.post .modal-action').click(function (e) { e.preventDefault(); var projet_id = $(this).data('projet_id');
function urlId() {
//je récupère l'id de l'url
$('.post .modal-action').click(function (e) {
e.preventDefault();
var projet_id = $(this).data('projet_id');
var $hidennDiv = $('#' + projet_id);
// j'injecte l'id dans l'url de l'ajax
$.ajax({
url: 'core/libs/contents-services.php?action=getModal&id=' + projet_id,
type: "get",
dataType: "html",
success: function (reponse) {
$('#myModal--effect-fullwidth').html(reponse);
projet_id = reponse.projet_id;
}
});
});
}
这是关闭模式的按钮的代码:
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true" class="text-white">x</span>
</button>
x
这是具有id的模态的链接:
<a href="#myModal--effect-fullwidth" data-toggle="modal" data-target="#myModal--effect-fullwidth" class="btn modal-action text-white" data-projet_id="'.$contents_brand[ 'projet_id' ].'">Découvrir</a>
我正在使用这个框架:fezvrasta(引导材料设计)
可能是我的js函数中缺少了一些东西或代码?请帮助我。我找到了一个解决方案:
在my action中添加show.bs.modal单击my js函数