From bd56aee1622f3c5cf926b7e0229eee9a32131654 Mon Sep 17 00:00:00 2001 From: Junior Date: Mon, 29 Sep 2025 10:58:38 -0400 Subject: [PATCH] Add error handling to jQuery AJAX calls --- js/comics.js | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/js/comics.js b/js/comics.js index ea8261a..b0326f1 100644 --- a/js/comics.js +++ b/js/comics.js @@ -38,6 +38,10 @@ function getSortOrder(refresh = true) { $("#sortorder").html(data.order); if ( refresh ) getFolderContents(); } + }, + error : function(xhr, stat, err) { + console.log(xhr.status); + console.log(err); } }); } @@ -59,6 +63,10 @@ function cycleSortOrder() { $("#sortorder").html(data.order); getFolderContents(); } + }, + error : function(xhr, stat, err) { + console.log(xhr.status); + console.log(err); } }); } @@ -97,7 +105,11 @@ function getFolderContents() { $(".folder").click(function() { changeFolder($(this).data("name"), $(this).data("path")); }); $(".issue").click(function() { $(this).parent().addClass("readborder"); showComic($(this).data("relcomic"), $(this).data("comname")); }); toastr.remove(); - } + }, + error : function(xhr, stat, err) { + console.log(xhr.status); + console.log(err); + } }); } @@ -141,7 +153,11 @@ function changeFolder(name, path) { foldername = data.foldername; toastr.remove(); getFolderContents(); - } + }, + error : function(xhr, stat, err) { + console.log(xhr.status); + console.log(err); + } }); } @@ -166,7 +182,11 @@ function updateCurrentPage() { return; } console.log(data.message); - } + }, + error : function(xhr, stat, err) { + console.log(xhr.status); + console.log(err); + } }); } @@ -196,7 +216,11 @@ function showComic(comic, name) { startAt: data.startindex, beforeSetContent: updateCurrentPage }); - } + }, + error : function(xhr, stat, err) { + console.log(xhr.status); + console.log(err); + } }); }