gpt4 book ai didi

javascript - jquery 自动刷新后 div 弹出窗口不起作用

转载 作者:行者123 更新时间:2023-11-28 04:49:20 25 4
gpt4 key购买 nike

我有一个 jquery 可以刷新 div,但刷新后弹出窗口无法根据刷新的数据工作。

<script type="text/javascript">
$(function() {
$.ajaxSetup ({
cache: false
});
//Refresh trigger `#newORDERx`
var auto_refreshes = setInterval(function () {$('#newORDERx').load('inc/restAdmin_orders_rcvz.php');}, 1000);
});
</script>
<div id="newORDERx"></div>

当我像下面一样使用它时,弹出窗口工作正常,但它不会刷新 div。

<script type="text/javascript">
$(document).ready(function(){
$.ajaxSetup ({
cache: false
mainClass: 'pp-product-detail' // when i use this then popup works but then doesn't refresh the div
});
var auto_refreshes = setInterval(function () {$('#newORDERx').load('inc/restAdmin_orders_rcvz.php');}, 1000);
});

</script>

pp-产品详细信息类

AJAX popup

if ($('.pp-product-detail').length) {
$('.pp-product-detail').magnificPopup({
type: 'ajax'
});
}

restAdmin_orders_rcvz.php

<div class="col-lg-6">
<div class="the-menu-item">
<div class="image-wrap">
<a class="pp-product-detail" href="product-detail-popup-rest-admin-order-rcv.php?iid=<?php echo $phporder; ?>">
<img src="images/themenu/img-1.jpg" alt="">
</a>
</div>
<div class="the-menu-body">
<b><font color='red'> Order # </font> <?php echo $phporder; ?><br>
<font color='red'> Items Included : </font> <?php echo $lrsa['count']; ?>
<br><font color='red'>Dated : </font> <?php echo date("d/m/Y", strtotime($phpdates)); ?>
</b>
</div>
</div>
</div>

最佳答案

好的...我很确定问题出在您的 class 中,因为您重写了 .pp-product-detail 元素...

所以尝试将其更改为:

if ($(document).find('.pp-product-detail').length) {
$(document).find('.pp-product-detail').magnificPopup({
type: 'ajax'
});
}

关于javascript - jquery 自动刷新后 div 弹出窗口不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43076551/

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