## XMLHttpRequests - What is an Http request? - Life of a request - https://dev.to/dangolant/things-i-brushed-up-on-this-week-the-http-request-lifecycle- - REST - Verbs - Headers - Status codes - Example w/ curl - Now how do we send a request with a browser? - Websites of the early era required a complete page load upon each request (https://en.wikipedia.org/wiki/Ajax_(programming)) - This is inefficient and provides a bad user experience with full reloads on each action. Example: MapQuest in the early days. - AJAX - Gmail in 2004 and Google Maps in 2005 - A way for browsers to send requests asyncronously! ð - In 2006, W3C releated XMLHttpRequest specification - XMLHttpRequest - Guide: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest ## API calls - Open API's without need for auth tokens (https://github.com/public-apis/public-apis/blob/master/README.md). Use one for example. - Create new HTML file - Create a button that will have an event listener - Retrieve data from api with XMLHttpRequest obj - ...but callbacks? [joke](https://www.reddit.com/r/ProgrammerHumor/comments/che938/asynchronous_javascript/) ## Structure for a basic SPA