gpt4 book ai didi

javascript - jquery ajax 关闭后发布

转载 作者:行者123 更新时间:2023-12-03 04:27:40 25 4
gpt4 key购买 nike

我有data-id并且我想在模式隐藏/关闭后发布data-id,我该怎么做?

$(function() {
var popup = $('#AniPopup');
var time = $(".will-close strong");
var closeSeconds = $("#AniPopup").attr("data-close");
var openSeconds = $("#AniPopup").attr("data-open");
var dataSrc = $("#AniPopup").attr("data-src");
var dataId = $("#AniPopup").attr("data-id");


setTimeout(function(e) {

popup.modal('show');
time.html(closeSeconds);

setInterval(function(){
time.html(closeSeconds);
closeSeconds--;

if(closeSeconds < 0){
popup.modal('hide');
}

}, 1000)

}, openSeconds * 1000);

$.ajax({
url: dataSrc,
dataType: "html",
success: function(data) {
$(".modal-body").html(data);
}
});


});
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

<div class="modal fade" id="AniPopup" tabindex="-1" role="dialog" aria-labelledby="AniPopupLabel" aria-hidden="true" data-close="10" data-open="2" data-src="http://www.anitur.com.tr/popup/test-6-text" data-id="69">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="memberModalLabel">Popup Header</h4>
</div>
<div class="modal-body">
this content loaded by ajax
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Kapat</button>
<span class="will-close">will be closed after : <strong>n</strong> seconds</span>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

最佳答案

使用引导模式的标准事件hidden.bs.modal:

$("#AniPopup").on('hidden.bs.modal', function () {
// do your staff here
});

关于javascript - jquery ajax 关闭后发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43629163/

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