$.ajax({ type: 'GET', async: false, url: '/api/discovery', success: function(data) { window.__endpoints = data.endpoints; }, error: function() { setTimeout(function() { $('#couldnotloadModal').modal({}); }, 250); } });