Result Size: 300 x 150
x
 
<!DOCTYPE html>
<html lang='uk'>
<body>
<h2>Отримати дані JSON із сервера PHP</h2>
<p>Перетворіть дані на масив JavaScript:</p>
<p id="demo"></p>
<script>
const xmlhttp = new XMLHttpRequest();
xmlhttp.onload = function() {
  const myObj = JSON.parse(this.responseText);
  document.getElementById("demo").innerHTML = myObj[2];
}
xmlhttp.open("GET", "demo_file_array.php");
xmlhttp.send();
</script>
</body>
</html>