[英]After jquery auto refresh a div popup doesnt work
I have a jquery which refreshes the div but after refresh the popup doesn't work from the refreshed data. 我有一个刷新div的jquery但刷新后弹出窗口不能刷新数据。
<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>
When i use it like below then popup works fine but then it doesn't refresh the 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-product-detail class pp-product-detail类
AJAX popup
if ($('.pp-product-detail').length) {
$('.pp-product-detail').magnificPopup({
type: 'ajax'
});
}
restAdmin_orders_rcvz.php 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>
Okay... I'm pretty sure that the problem is in your class
, since you re-write the .pp-product-detail
element... 好的...我很确定你的class
存在问题,因为你重写了.pp-product-detail
元素......
So try to change it to this: 所以尝试将其更改为:
if ($(document).find('.pp-product-detail').length) {
$(document).find('.pp-product-detail').magnificPopup({
type: 'ajax'
});
}
I have just added following file in restAdmin_orders_rcvz.php
and its working fine. 我刚刚在restAdmin_orders_rcvz.php
添加了以下文件,并且工作正常。
<script type="text/javascript" src="js/scripts.js"></script>
restAdmin_orders_rcvz.php 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.