JavaScript and AJAX tutorial What is AJAX lyndacom

[Music] so you may be wondering what Ajax is and why you want to learn more about it so let's take a look at how you can use Ajax with JavaScript to build dynamic web applications before we look at Ajax let's talk about how a browser gets information to display a page when a browser requests a page from a website the browser in your machine is acting as a client the website is being delivered through a machine that is serving up the information so we call that a server when you ask for a page the client makes a request to the server and the server returns a page sometimes when you're looking at a page you may want to ask for some additional information from the server say for example that your page has thumbnails for a photo album and perhaps the album has more thumbnails you can see in the current view without Ajax if you want to see more thumbnails you'd have to make a request back to the server and it would send you a whole new page with additional thumbnails that means the server ends up sending a lot of information that you don't really need all over again with Ajax server doesn't have to send you the whole page it just sends the pieces you need in this case news thumbnails so how does that work Ajax is not a single technology but a group of technologies working together to make that happen technically Ajax stands for asynchronous JavaScript and XML that's quite a mouthful so let's break that down piece by piece asynchronous means that the client can request new pieces of information from the server at any time it doesn't have to wait for a page to reload a new request can be triggered by an event like clicking on a button hovering over an image or whatever the Jai and Ajax stands for JavaScript javascript is where all this magic takes place it handles the events that trigger a new request makes the request for new data to the server and takes care of updating only the part of the document that needs to change javascript talks to the server through a set of programming methods called an api and uses what's called an xhr or XML HTTP request this is where the X and Ajax comes from the xhr API lets the browser send data from a server this can be a bit confusing because a lot of people think of XML as a language used to describe data that's a lot like HTML sometimes people assume that the X and Ajax means that the data from an ajax request has to be in xml but the data that gets transferred to and from the server can be in any format and it's usually either a text file HTML or a javascript object like JSON so ajax is really just a fancy term for a technology lets you build pages that update without requiring a page reload javascript does most of the heavy lifting with ajax and it uses the xhr api to handle the communication between the client and the server a membership to linda.com unlocks this entire course and hundreds of others visit linda.com to learn more

Loading