Create an AJAX script, which will load the Star Wars file from the server: https://www.omdbapi.com/?s=star+wars&apikey=cbbc6750.
NOTE: The raw JSON data looks weird on the browser. You can use developer tools to study the contents by inspecting the DIV.
The sample function shown in PowerPoint slides is pasted below.
// Load AJAX content into web page
function loadJSONLDoc() {
// Create AJAX object
var xmlhttp = new XMLHttpRequest();
// Specify the data / url to be fetched
xmlhttp.open("GET", "INSERT URL/FILENAME HERE", true);
xmlhttp.send();
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
// find myDiv and insert results there
document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
}
}
}