Add error handling to jQuery AJAX calls
This commit is contained in:
parent
4e582d96e1
commit
bd56aee162
24
js/comics.js
24
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,6 +105,10 @@ 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,6 +153,10 @@ function changeFolder(name, path) {
|
|||
foldername = data.foldername;
|
||||
toastr.remove();
|
||||
getFolderContents();
|
||||
},
|
||||
error : function(xhr, stat, err) {
|
||||
console.log(xhr.status);
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -166,6 +182,10 @@ function updateCurrentPage() {
|
|||
return;
|
||||
}
|
||||
console.log(data.message);
|
||||
},
|
||||
error : function(xhr, stat, err) {
|
||||
console.log(xhr.status);
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -196,6 +216,10 @@ function showComic(comic, name) {
|
|||
startAt: data.startindex,
|
||||
beforeSetContent: updateCurrentPage
|
||||
});
|
||||
},
|
||||
error : function(xhr, stat, err) {
|
||||
console.log(xhr.status);
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user