common.js: show error on ajax failures.

Make `link_to ..., remote: true` ajax requests display an error notice on failure.
This commit is contained in:
evazion
2018-04-07 11:37:23 -05:00
parent 8de20d2b36
commit ad66b8abc9

View File

@@ -39,6 +39,11 @@ $(function() {
location.reload(); location.reload();
}); });
}); });
// triggered by rails when a `link_to ..., remote: true` call fails.
$(document).on("ajax:error", function (event, xhr, status, error) {
Danbooru.error("Error: " + xhr.status + " " + xhr.statusText);
});
}); });
var Danbooru = {}; var Danbooru = {};