keep the spinner visible while the image loads

This commit is contained in:
Jakob Ketterl 2021-05-07 17:44:24 +02:00
parent 0206a6f94c
commit 1b31c5fc90

View File

@ -54,6 +54,10 @@ $.fn.imageUpload = function() {
contentType: 'application/octet-stream',
}).done(function(data){
$input.val(data.file);
$img.one('load', function() {
$uploadButton.prop('disabled', false);
$spinner.remove();
});
$img.prop('src', '../imageupload?file=' + data.file);
clearError();
}).fail(function(xhr, error){
@ -63,7 +67,6 @@ $.fn.imageUpload = function() {
} catch (e) {
handleError(error);
}
}).always(function(){
$uploadButton.prop('disabled', false);
$spinner.remove();
});