Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Fetch API</h1> <h2>The fetch() Method</h2> <p id="demo">Fetch a file to change this text.</p> <script> getText("fetch_info.txt"); async function getText(file) { let x = await fetch(file); let y = await x.text(); document.getElementById("demo").innerHTML = y; } </script> </body> </html>