crop_rotate
Run
<!DOCTYPE html> <html> <body> <h2>Fetch a JSON file with XMLHttpRequest</h2> <p>Content written as an JSON array will be converted into a JavaScript array.</p> <p id="demo"></p> <script> const xmlhttp = new XMLHttpRequest(); xmlhttp.onload = function() { const myArr = JSON.parse(this.responseText); document.getElementById("demo").innerHTML = myArr[0]; } xmlhttp.open("GET", "/files/json_demo_array.txt", true); xmlhttp.send(); </script> </body> </html>
Fetch a JSON file with XMLHttpRequest
Content written as an JSON array will be converted into a JavaScript array.