Загрузочный модал не отображается на второй вкладке
У меня есть две вкладки на странице. Обе вкладки содержат некоторые динамические данные, извлеченные из MYSQL
дб. При открытии популярной вкладки данных нажатием кнопки "получить код" появляется модальное окно. Но в другой вкладке, заканчивающей вкладку, нажатием кнопки "получить код" модал не появляется. Почему это так? Как это решить.
КОД
<ul class="nav nav-tabs responsive-tabs" id="myTab">
<li class="active"><a data-toggle="tab" href="#popular"><i class="ti-bar-chart"></i>Popular </a> </li>
<li class=""><a data-toggle="tab" href="#ending"><i class="ti-timer"></i> Ending soon</a> </li>
</ul>
<div class="tab-content clearfix" id="myTabContent">
<div id="popular" class="tab-pane counties-pane active animated fadeIn">
<?php
$q=mysqli_query($con," SELECT c.* , sc.* , sm.* ,ca.* from store_category sc INNER JOIN store_manufacture sm ON sm.sm_id=sc.store_id INNER JOIN categories ca ON ca.cat_id=sc.cat_id INNER JOIN coupons c on c.c_sc_id=sc.sc_id where sm.sm_display=1 AND ca.cat_switch=1 limit 10 ");
while($row1=mysqli_fetch_array($q,MYSQLI_ASSOC)) {
$h = strpos($row1['sm_link'], 'http');
?>
<div class="coupon-wrapper row">
<div class="coupon-data col-sm-2 text-center">
<div class="savings text-center">
<div>
<div class="large"><?php echo $row1['c_name'] ?></div>
<div class="small">off</div>
<div class="type"><?php echo $row1['sm_brand_name'] ?></div>
</div>
</div>
</div>
<div class="coupon-contain col-sm-7">
<h4 class="coupon-title"><?php echo $row1['c_description']?></h4>
<p data-toggle="collapse" data-target="#<?php echo $row1['c_id']?>">Shop these <?php echo $row1['sm_brand_name'] ?> deals of the day to save as much...</p> <p id="<?php echo $row1['c_id'] ?>" class="collapse">Don't miss out on all the coupon savings.Get you coupon now and save big</p>
<!-- end:Coupon details -->
</div>
<!-- end:Coupon cont -->
<div class="button-contain col-sm-3 text-center">
<p class="btn-code" data-toggle="modal" data-target="#couponModal<?php echo $row1['c_id']?>" data-id="<?php echo $row1['c_id'] ?>" data-backdrop="false" data-dismiss="modal">
<span class="partial-code"><?php echo $row1['c_code'] ?></span>
<a href="<?php echo ($h !== FALSE)?$row1['sm_link']:"http://".$row1['sm_link'] ?>" target="_blank"><span class="btn-hover">Get Code</span></a>
</p>
</div>
</div>
<div class="coupon_modal modal fade couponModal" style="background-color: rgba(0, 0, 0, 0.5);" id="couponModal<?php echo $row1['c_id'] ?>" tabindex="-1" role="dialog" >
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i class="ti-close"></i></span> </button>
<div class="coupon_modal_content">
<div class="row">
<div class="col-sm-10 col-sm-offset-1 text-center">
<h2><?php echo $row1['c_name'] ?></h2>
<p><?php echo $row1['c_description'] ?></p>
</div>
<div class="row">
<div class="col-sm-12">
<h5 class="text-center text-uppercase m-t-20 text-muted">Click below to get your coupon code</h5></div>
<div class="col-sm-4 col-sm-offset-4 col-xs-6 col-xs-offset-3"> <a href="<?php echo ($h !== FALSE)?$row1['sm_link']:"http://".$row1['sm_link'] ?>" target="_blank" class="coupon_code alert alert-info"><span class="coupon_icon"><i class="ti-cut hidden-xs"></i></span> <?php echo $row1['c_code'] ?> </a>
</div></div></div> </div></div></div></div>
<?php
}
?>
</div>
<!--ending tab -->
<div id="ending" class="tab-pane counties-pane animated fadeIn">
<?php
$q=mysqli_query($con,"SELECT c.* , sc.* , sm.* ,ca.* from store_category sc INNER JOIN store_manufacture sm ON sm.sm_id=sc.store_id INNER JOIN categories ca ON ca.cat_id=sc.cat_id INNER JOIN coupons c on c.c_sc_id=sc.sc_id WHERE sm.sm_display=1 AND ca.cat_switch=1 AND c.c_date_expired >= CURDATE() AND c.c_date_expired <= DATE(DATE_ADD(CURDATE(), INTERVAL +20 DAY))");
while($row1=mysqli_fetch_array($q,MYSQLI_ASSOC)) {
$h = strpos($row1['sm_link'], 'http');
?>
<div class="coupon-wrapper row">
<div class="coupon-data col-sm-2 text-center">
<div class="savings text-center">
<div>
<div class="large"><?php echo $row1['c_name'] ?></div>
<div class="small">off</div>
<div class="type"><?php echo $row1['sm_brand_name'] ?></div>
</div>
</div>
</div>
<div class="coupon-contain col-sm-7">
<ul class="list-inline list-unstyled">
<li class="sale label label-pink">Ending soon- Last Date:<?php echo $row['c_date_expired'] ?></li>
<li class="popular label label-success">100% success</li>
<li><span class="verified text-success"><i class="ti-face-smile"></i>Verified</span></li>
</ul>
<h4 class="coupon-title"><?php echo $row1['c_description']?></h4>
<p data-toggle="collapse" data-target="#<?php echo $row1['c_id']?>">Shop these <?php echo $row1['sm_brand_name'] ?> deals of the day to save as much...</p> <p id="<?php echo $row1['c_id'] ?>" class="collapse">Don't miss out on all the coupon savings.Get you coupon now and save big</p>
<!-- end:Coupon details -->
</div>
<!-- end:Coupon cont -->
<div class="button-contain col-sm-3 text-center">
<p class="btn-code" data-toggle="modal" data-target="#couponModal<?php echo $row1['c_id']?>" data-id="<?php echo $row1['c_id'] ?>" data-backdrop="false" data-dismiss="modal">
<span class="partial-code"><?php echo $row1['c_code'] ?></span>
<a href="<?php echo ($h !== FALSE)?$row1['sm_link']:"http://".$row1['sm_link'] ?>" target="_blank"><span class="btn-hover">Get Code</span></a>
</p>
</div>
</div>
<div class="coupon_modal modal fade couponModal" style="background-color: rgba(0, 0, 0, 0.5);" id="couponModal<?php echo $row1['c_id'] ?>" tabindex="-1" role="dialog" >
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i class="ti-close"></i></span> </button>
<div class="coupon_modal_content">
<div class="row">
<div class="col-sm-10 col-sm-offset-1 text-center">
<h2><?php echo $row1['c_name'] ?></h2>
<p><?php echo $row1['c_description'] ?></p>
</div>
<div class="row">
<div class="col-sm-12">
<h5 class="text-center text-uppercase m-t-20 text-muted">Click below to get your coupon code</h5></div>
<div class="col-sm-4 col-sm-offset-4 col-xs-6 col-xs-offset-3"> <a href="<?php echo ($h !== FALSE)?$row1['sm_link']:"http://".$row1['sm_link'] ?>" target="_blank" class="coupon_code alert alert-info"><span class="coupon_icon"><i class="ti-cut hidden-xs"></i></span> <?php echo $row1['c_code'] ?> </a>
</div></div></div> </div></div></div></div>
<?php
}
?>
</div>