0
<a class="btn btn-info" href="home/delete" onclick="return confirmDelete()">
<i class="glyphicon glyphicon-edit icon-white"></i>
Delete
</a>
confirmDelete
函數打開頁面,不等待返回函數。我的功能是:javascript button onClick不等功能返回true並打開鏈接
function confirmDelete(){
bootbox.confirm("Are you sure?", function(result) {
if (result) {
console.log("User confirmed dialog");
return true;
} else {
console.log("User declined dialog");
return false;
}
});
但下面的代碼工作正常,並等待ok打開鏈接。
<a class="btn btn-info" href="home/delete" onclick="return confirm()">
<i class="glyphicon glyphicon-edit icon-white"></i>
Delete
</a>
謝謝,它工作:)而且我修改了我的原始代碼的href它被加密之前發送與獲取手段而不是href =「家/刪除」其href =「家/刪除/ asjfaskdjfksljfksafsaf」(一些ID ):) –