var authNS = {}; ;(function($){ authNS.verify = function() { // Get current user status from server $.ajax({ url: '/user/user', dataType: 'json', type: 'GET', data: '{}', cache: false, complete: function() { setTimeout(function() { $('.loadingScreen') .fadeOut('normal', function() { $(this).remove(); }); }, 200); // give a bit of extra time in case the load was instantaneous setTimeout(function() { $.ajax({ url: '/deleteSessionServlet?session_name=show_update_contact', dataType: 'json', type: 'GET', data: '{}', cache: false, complete: function() { }, success: function(response, status) { }, error: function(request, status, error) { } }) }, 5000); }, success: function(response, status) { authNS.currentUser = response; $('div.downloadPage').removeClass('hideSession'); }, error: function(request, status, error) { authNS.currentUser = null; window.location.replace("/index.html?callback=prod"); } }); }; authNS.verify(); })(jQuery);