This example uses lbguilherme/crystal-js library.
See the output in browser developer console.
Actual code:
req = XMLHttpRequest.new req.open("GET", "https://httpbin.org/anything", false) req.send JS.console.log req.response_text
Warning This example employs XMLHTTPRequest in synchronous form. Consider making such calls only from inside of Web Workers to avoid UI freezes.
And this example: