如何将问题提示框转换为模态

时间:2018-11-23 03:47:37

标签: javascript php

我想将此警报框转换为模式,但我不能,我想知道如何将警报更改为模式,因为我想在Webview Android中使用它。 Alert Box

这是我的代码 index.php https://pastebin.com/zeKJJdUc

<?php
$connect = mysqli_connect("localhost", "root", "", "coba2");
$query = "SELECT * FROM siswa ";
$result = mysqli_query($connect, $query);
?>
<!DOCTYPE html>
<html>
<head>
<title>Verifikasi</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<br />
<h3 align="center">Verifikasi</h3><br />
<div align="center">
<button type="button" name="btn_verifpo" id="btn_verifpo" class="btn btn-success">Verifikasi</button>
</div>
<?php
if(mysqli_num_rows($result) > 0)
{
?>
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<th>NO_Urut</th>
<th>TGL</th>
<th>Cek</th>
<th width="15%">View</th> 
</tr>
<?php
 while($row = mysqli_fetch_array($result))
 {
?>
<tr id="<?php echo $row["row_id"]; ?>" >
<td><?php echo $row["NO_PO"]; ?></td>
<td><?php echo $row["TGL"]; ?></td>
<td><input type="checkbox" name="baris_id[]" class="verifySISWA" value="<?php echo $row["row_id"]; ?>" /></td>
<td><input type="button" name="view" value="view" id="<?php echo $row["NO_Urut"]; ?>" class="btn btn-info btn-xs view_data" /></td>
  </tr>
<?php
 }
?>
</table>
</div>
<?php
}
?>
<div id="dataModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Details</h4>  
</div>  
<div class="modal-body" id="DetailSIS">  
</div>  
<div class="modal-footer">  
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>  
</div>  
</div>  
</div>  
</div> 
</body>
</html>
<script>
$(document).ready(function(){
 $('#btn_verifpo').click(function(){
  if(confirm("Verifikasi Data Yang dipilih?"))
  {
var id = [];
$(':checkbox:checked').each(function(i){
 id[i] = $(this).val();
});
if(id.length === 0) //tell you if the array is empty
{
 alert("Pilih 1 Cekbox");
}
else
{
 $.ajax({
  url:'verif.php',
  method:'POST',
  data:{id:id},
  success:function()
  {
for(var i=0; i<id.length; i++)
{
 $('tr#'+id[i]+'').css('background-color', '#ccc');
 $('tr#'+id[i]+'').fadeOut('slow');
}
  }

 });
}
  }
  else
  {
return false;
  }
 });
$(document).on('click', '.view_data', function(){  
  var row_id = $(this).attr("id");  
  if(row_id != '')  
  {  
 $.ajax({  
url:"select.php",  
method:"POST",  
data:{no_po:row_id},
success:function(data){  
  $('#DetailSIS').html(data);  
  $('#dataModal').modal('show');  
}  
 });  
  }
});
});
</script>

这是验证,以使用该表中的复选框验证选择。 verify.php https://pastebin.com/aWBp9FTn

<?php
$connect = mysqli_connect("localhost", "root", "", "coba2");
if(isset($_POST["id"]))
{
 foreach($_POST["id"] as $id)
 {

  $query = "UPDATE siswa SET verif = '1' WHERE row_id = '".$id."' ";
  mysqli_query($connect, $query);GK/MDDD
 }
}
?>

非常感谢您。

0 个答案:

没有答案