let ResData = null fetch('http://mo.samuelzielke.de/api/') .then(response => response.json()) .then(data => { ResData=data; window.readyrequest = true; window.ResData = ResData; }) .catch(error => console.error('Error:', error)); let stopped = false while(!stopped){ console.log("Warten"); if (ResData != null) stopped = true; } const DATA = ResData