@quad If you don't want to learn how event-loop based async code works you can just use a sync XmlHttpRequest (it's deprecated btw https://developer.mozilla.org/fr/docs/Web/API/XMLHttpRequest/Synchronous_and_Asynchronous_Requests)
Or I can give you examples of asynchronous solutions if you're interested.