X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/6beafb16431a1cf87ad160ab50b07db31971d873..ee9ae6193aefe2a28522a71406cbb92614844f1e:/src/assets/js/base.js diff --git a/src/assets/js/base.js b/src/assets/js/base.js index c7ae6f9..4ff6b23 100644 --- a/src/assets/js/base.js +++ b/src/assets/js/base.js @@ -131,14 +131,17 @@ function hide_error() { } -$(document).ajaxError(function (event, jqXHR, ajaxSettings/* , thrownError */) { - // console.log(thrownError); - // console.log(ajaxSettings); - var url = ajaxSettings.url; - show_error('Error fetching results from ' + url + ''); -}); - - jQuery(document).ready(function () { hide_error(); + + $(document).ajaxStart(function () { + $('#loading').fadeIn('fast'); + }).ajaxComplete(function () { + $('#loading').fadeOut('fast'); + }).ajaxError(function (event, jqXHR, ajaxSettings/* , thrownError */) { + // console.log(thrownError); + // console.log(ajaxSettings); + var url = ajaxSettings.url; + show_error('Error fetching results from ' + url + ''); + }); });