我想在连接控制器之前删除表中的数据时使用sweetalert。但它只会打电话给我的控制器,并且不会显示任何警报。
<a href="Table/Delete/<?php echo ($u->ID) ?>">
<button id="a" type="button" class="btn btn-danger"> <i class="glyphicon glyphicon-trash"></i> Delete </button>
</a>
JS
<script>
$('#a').on('click',function(event){
event.preventDefault();
swal({
title: "Are you sure?",
text: "Once deleted, you will not be able to recover this imaginary file!",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
swal("Poof! Your imaginary file has been deleted!", {
icon: "success",
});
} else {
swal("Your imaginary file is safe!");
}
});
})
</script>
答案 0 :(得分:0)
不要使用public void sharedMethod() {
System.out.println("I'm a shared method in the SubClass");
}
链接
HTML应该像..
<a href="...">
js应该如下
<div>
<button id="a"></button>
</div>