当我点击sil按钮时,“你确定要删除吗?”当我点击该消息时,会出现一个空白消息页面,并且不会删除该数据。
(document).ready(function(){
var productTable = $('#product_data').bootgrid({
ajax: true,
rowSelect: true,
post: function()
{
},
url: "fetch.php",
formatters: {
"commands": function(column, row)
{
var link="";
/*
1001 => "siparis_toplubaski"
1002 => "siparis_ana"
1003 => "siparis_cokluforma"
1004 => "siparis_digitalbaski"
1005 => "siparis_etiket"
1006 => "siparis_matbuu"
1007 => "siparis_ofset"
*/
if(row.formid==1001){
link="siparis_toplubaski.php?DAID="+row.Id;
}else if(row.formid==1002){
link="siparis_ana.php?DAID="+row.Id;
}else if(row.formid==1003){
link="siparis_cokluforma.php?DAID="+row.Id;
}else if(row.formid==1004){
link="siparis_digitalbaski.php?DAID="+row.Id;
}else if(row.formid==1005){
link="siparis_etiket.php?DAID="+row.Id;
}else if(row.formid==1006){
link="siparis_matbuu.php?DAID="+row.Id;
}else if(row.formid==1007){
link="siparis_ofset.php?DAID="+row.Id;
}
return "<a href='"+link+"' type='button' class='btn btn-warning btn-xs update' data-row-id='"+row.Id+"'>Düzenle</a>" +
" <button type='button' class='btn btn-danger btn-xs delete' data-row-id='"+row.Id+"'>Sil</button>"
}
}
});
$(document).on("loaded.rs.jquery.bootgrid", function()
{
productTable.find(".delete").on("click", function(event)
{
if(confirm("Are you sure you want to delete this?"))
{
var Id = $(this).data("+row.Id+");
$.ajax({
url:"delete.php",
method:"POST",
data:{Id:Id},
success:function(data)
{
alert(data);
$('#product_data').bootgrid('reload');
}
})
}
else{
return false;
}
});
});
});
这是delete.php
<?php
//delete.php
include("connection.php");
if(isset($_POST["product_id"]))
{
$query = "DELETE FROM siparis_ana WHERE Id = '".$_POST["id"]."'";
if(mysqli_query($connection, $query))
{
echo 'Data Deleted';
}
}
?>