when clicked on the button onClick = "Delete" instead redirects to http://localhost/example.com/?
It should show a popup delete menu, click "delete". and data is deleted.
View button:
<button class="btn btn-sm btn-clean btn-icon" onclick="delete_order('<?php echo $value->idorder; ?>');" data-toggle="tooltip" title="delete order"><i class="la la-trash"></i></button>
Script js:
function deleteBanner(id) {
swal({
title: "Hapus Banner ini ?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Hapus",
cancelButtonText: "Batal",
closeOnConfirm: false,
closeOnCancel: false
},
function(isConfirm) {
if (isConfirm) {
$.ajax({
url: "<?php echo base_url('admin/Design/delete_banner'); ?>",
method: "POST",
data: {
"id": id
},
success: function(data) {
$('#alert').html(data);
dataBanner();
}
});
swal("Terhapus!", "Image Terhapus", "success");
} else {
swal("", "", "error");
}
});
}
I am very happy and grateful if anyone can help check if there is a writing error? or what should I fix and what's the problem!
Because I tried to check repeatedly there was no problem with writing the script.
CodePudding user response:
Thanks for all the answers, i finally found the solution. just add <a href='javascript:void(0)';> problem can be solved.