Link library: https://github.com/toplan/ajax-loading-animation/blob/master/ajax-loading.js

Insert to functions.php: (link to file loading-ajax.js)

Frontend: