<script>
  function del(iden,action){
    var dataString = "id="+iden+"&action="+action;
    var status = $("#status").val();
    var identity = $('#loadings')+iden;
    var confirms = confirm("Are you sure you want to continue?");
    if (confirms == true) {
    $.ajax({
        type: "POST",
        url: "control.php",
        cache : false,
        data : dataString,
        beforeSend : function(){
            $('#del'+iden).hide();
            $('#loadings'+iden).show();
        },
        success : function(response){
            $('#loadings'+iden).hide();
            document.getElementById('inputHere').innerHTML = response;
            $('#myModal').modal('show');
            window.location.reload(1);
        }
    });
}
}
</script>

                        <?php
                         $select = $conn->query("SELECT * FROM announcement WHERE package = '$vlink2'");
                            $fetch = $select->fetchAll(PDO::FETCH_OBJ);
                            $count = $select->rowCount();
                            $serial = 1;
                            if ($count > 0) {
                              foreach ($fetch as $value) {
                              $noteid = $value->id;
                              $text = $value->text;
                            ?>
                            <div class="row">
                            <div class="col-12">
                               <div class="panel panel-default">
                                  <div class="panel-body">
                                    <p><?php echo "$text"; ?></p><hr>
                                     <button class="btn btn-default btn-xs" title="Delete" id="del<?php echo $noteid?>" onclick= "del('<?php echo $noteid ?>', 'delannouncement')"><i class="fa fa-trash"></i></button><span id="loadings<?php echo $noteid ?>" style="display:none"><img src="img/loading.gif"></span>   
                                  </div>
                               </div> 
                            </div>
                          </div>
                            <?php
                            $serial++;
                              }
                            }else{
                            ?>
                        <div class="row">
                            <div class="col-12">
                               <div class="panel panel-default">
                                  <div class="panel-body">
                                    <div class="alert alert-info">
                                      <p>No announcement yet</p>
                                    </div>
                                        
                                  </div>
                               </div> 
                            </div>
                          </div>
                            <?php
                            }
                        ?>
                                         
</div>

                      


<div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog modal-sm">
      <div class="modal-content">
        <div class="modal-body text-center">
        <div id="inputHere">

        </div>
        </div>
        </div>
      </div>
    </div>


<div class="modal fade" id="myModal2" role="dialog">
    <div class="modal-dialog modal-sm">
      <div class="modal-content">
        <div class="modal-body text-center">
        <?php  
        if (isset($mess)) {
        echo "$mess";
        }
        ?>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Ok</button>
        </div>
        </div>
      </div>
    </div>

<?php
if(isset($mess)){
?>
<script type="text/javascript">
   $(window).load(function(){
   $('#myModal2').modal('show');
   }); 
</script>
<?php
  }
?>