I try a simple login form, there is a Loading indicator, which hangs. Help me to understand.
// Attach AJAX "loading" event listener $(document).on({ ajaxStart : function() { $("#loadingBox").show() }, ajaxStop : function() { $("#loadingBox").hide() } }); function loginUser(event) { event.preventDefault(); let userData = { username : $('#formLogin input[name=username]').val(), password : $('#formLogin input[name=passwd]').val() }; $.ajax({ method : "POST", url : "/login", data : userData, success : loginSuccess, error : handleAjaxError }); function loginSuccess(userData) { saveAuthInSession(userData); showHideMenuLinks(); showHomeView(); showInfo(loginSuccess); } } If you remove showInfo (loginSuccess), then the Loading indicator disappears when the request is successful, but accordingly I do not have a successful authentication message in this way.
function showInfo(message) { $('#infoBox').text(message); $('#infoBox').show(); setTimeout(function() { $('#infoBox').fadeOut(); }, 3000); }