## AJAX ### After this you will be able to: - use jquery ajax to make a get request ## Intro / Framing - **Intro**: today we'l learn a new way to make http requests. We've already seen: browser and curl requests. today we'll be seeing a different kind of browser request, one that isn't tied to the request response re-render cycle we're used to in the browser we **can** make requests from the browser, using javascript, without refreshing the page or having it rerender - **Context**: we are adding another layer of complexity, in that we are now going to make requests more and more from javascript what does this allwo us to do? - write a complex application that deals with it's data from the server transparent to the user - use your server less and the user's computer more - separation of concerns - back and front end - faster response times with smaller data - what are we losing? - The back and refresh button are rendered useless: You don't get some default browser behavior. - Javascript can be disabled: You can't know for sure what your users are up to. - You have to consider the UX even more: You can't rely on the default browser behavior - **Specific**: AJAX is current standard (besides websockets) for communicating directly with a front-end application written in javascript that runs in the browser. If we want to learn about applications in the browser, we have to know about AJAX. - **How**: We'll look at some examples of how to use the JQuery ajax functionality and what it is doing under the hood. Then you will write some JQuery ajax code. ## Setup While we're still learning the ins-and-outs of building APIs, lets use an already-made API for today. We'll use on that works a lot like Mongo and Express and comes with RESTful resources out of the box. That handy thing lives at https://api.doughnuts.ga/doughnuts – it's a simple dummy data service that'll let us do GETs & POSTs quickly. You can quickly check out https://www.doughnuts.ga/ to see what it's about. __Make a simple html and js file__ ```html