A Content Delivery Network CDN is a system of multiple servers that deliver web content to a user based on geographical location.
When you link to a hosted jQuery file via CDN, it will potentially arrive faster and more efficiently to the user than if you hosted it on your own server. We'll be using the CDN to reference jQuery in our examples. You can find the latest version of jQuery in Google's Hosted Libraries.
If instead you wish to download it, you can get a copy of jQuery from the official website. We will begin this exercise by creating a small web project.
After loading the content with ajax, call some local code that will find and hook up all the links. I would use addEventListener falling back to attachEvent to hook up this way as it more cleanly allows multiple listeners for a single object. Call some code after you load the content with ajax that finds all the links and hooks up the clicks to some generic click handler that can then examine meta data in the link and figure out what should be done on that click based on the meta data.
For example, this meta data could be attributes on the clicked link. When you load the content, also load code that can find each link individually and hook up an appropriate event handler for each link much the way one would do it if the content was just being loaded in a regular page.
Using Inspect on index. You can mess up the URL to test the error. XMLHttpRequest is a widely supported built-in method of making requests. There is also a newer Fetch API which can be used for the same purpose, which is simpler but has less browser support. By the end, our page will consist of a logo image followed by a container with multiple card elements — one for each film.
Each card will have a heading and a paragraph, that contains the title and description of each film. If you remember, our index. That should help clarify what is actually happening there. The first thing in our website is the logo, which is an img element. Now we have a logo and a container, and we just need to place them in the website. The last step will be to take what we consoled out previously and make them into card elements.
I write free resources that help thousands of people successfully become devs. If you enjoy my content, please consider supporting what I do. Your email address will not be published. This is a really great tutorial! I want to create a Pokedex application using an API and this gave me a better idea of how to do that.
I'm working on a major app that requires several API's.