doushoubu5360 2018-11-23 03:47
浏览 34

如何将问题警报框转换为模态

i want to convert this Alert Box into modal but i cant, i want to know how to change this alert to modal, because i want to use this in Webview Android. Alert Box

Here's my code 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>

This is verify to verify the selection that using checkbox in that table. 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
 }
}
?>

Thank you very much.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行
    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法