GET Labs
-
Create two files
xmlhttp.htmlandapp.js. -
Source your
app.jsfile into your html doc. -
Create a window
loadevent listener in yourapp.jsfile that prints out a message that the page has been loaded. -
In your onload function create an
XMLHttpRequestobject that will execute aGETrequest tohttps://skilldistillery.github.io/people.json -
Create an
onreadystatechangefunction that prints out the returnedresponseTextif the request was successful. -
If the request fails, write code that prints out that an error occurred to the console.
-
Change your
onreadystatechangecode to convert theresponseTextfrom JSON to javascript, and print out the first and last names from each returned object.