XHR Requests - nss-evening-cohort-04/mastery-exercise-spa-helanan GitHub Wiki

`var xhr = new XMLHttpRequest();

xhr.onload = function() { //The following conditional check will not work locally - only on a server

if(xhr.status === 200) { document.getElementById('container').innerHTML = xhr.responseText; // Update } };

xhr.open('GET', 'Javascripts/inventory.json', true); //Prepare the request xhr.send(null); //Send the request

//document.getElementById('container') ---> The element that will contain the new HTML is selected`