After Deleting a book the list page is still displayed #1938

This commit is contained in:
Ozzie Isaacs 2021-04-07 18:19:48 +02:00
parent fac232229e
commit 78071841cc
2 changed files with 5 additions and 3 deletions

View File

@ -142,10 +142,11 @@ $("#delete_confirm").click(function() {
//get data-id attribute of the clicked element //get data-id attribute of the clicked element
var deleteId = $(this).data("delete-id"); var deleteId = $(this).data("delete-id");
var bookFormat = $(this).data("delete-format"); var bookFormat = $(this).data("delete-format");
var ajaxResponse = $(this).data("ajax");
if (bookFormat) { if (bookFormat) {
window.location.href = getPath() + "/delete/" + deleteId + "/" + bookFormat; window.location.href = getPath() + "/delete/" + deleteId + "/" + bookFormat;
} else { } else {
if ($(this).data("delete-format")) { if (ajaxResponse) {
path = getPath() + "/ajax/delete/" + deleteId; path = getPath() + "/ajax/delete/" + deleteId;
$.ajax({ $.ajax({
method:"get", method:"get",
@ -187,6 +188,7 @@ $("#deleteModal").on("show.bs.modal", function(e) {
} }
$(e.currentTarget).find("#delete_confirm").data("delete-id", bookId); $(e.currentTarget).find("#delete_confirm").data("delete-id", bookId);
$(e.currentTarget).find("#delete_confirm").data("delete-format", bookfomat); $(e.currentTarget).find("#delete_confirm").data("delete-format", bookfomat);
$(e.currentTarget).find("#delete_confirm").data("ajax", $(e.relatedTarget).data("ajax"));
}); });