This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

Get JSON Data from a PHP Server

Convert the data into a JavaScript array:

// create XMLHttpRequest function
const xmlhttp = new XMLHttpRequest();
xmlhttp.onload = function() {

// create myObj JS array and display myObj [2] index value
  const myObj = JSON.parse(this.responseText);
  document.getElementById("demo").innerHTML = myObj[2];
};

// define the XMLHttpRequest
xmlhttp.open("GET", "demo_file_array.php");
xmlhttp.send();

demo_file_array.php