Nerede hata var bulamadım.
<script></script>
<script> </script>
İndex.php
href="">
 
<script>
 $(document).ready(function(){  
 $(document).on('click', '#delete_product', function(e){
 var productId = $(this).data('id');
 SwalDelete(productId);
 e.preventDefault();
});
});
function SwalDelete(productId){
swal({
title: 'Are you sure?',
text: "You won't be able to revert this!",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!',
showLoaderOnConfirm: true,
preConfirm: function() {
 return new Promise(function(resolve) {  
    $.ajax({
    url: 'delete.php?i=',
    type: 'GET',
       data: 'delete='+productId,
       dataType: 'json'
    })
    .done(function(response){
     swal('Deleted!', response.message, response.status);
 readProducts();
    })
    .fail(function(){
     swal('Oops...', 'Something went wrong with ajax !', 'error');
    });
 });
  },
 allowOutsideClick: false     
 }); 
}
</script>
delete.php
if ($_GET['delete']) {
	
  $id = $_GET["i"];
  $select = $db->prepare("select * from dosyam where dosya_id=?");
  $select->execute(array($id));
  $bul =  $select->fetch(PDO::FETCH_ASSOC); 
  
 unlink('../'.$bul["resim_dosyam"]);  
 
    $sil = $db->prepare("delete from dosyam where dosya_id=?");
	$ok = $sil->execute(array($id));
	
	if ($ok) {
	header("location:index.php?sil=ok");
	} else {
	header("location:index.php?sil=no");
	}
?>
  

