How to use APIs with JavaScript
The Client/Server Relationship

Did you see that? A few lines of JavaScript got us an "OK" from Codecademy, meaning the site is available! (We'll explain the "200" bit soon.)

We can use HTTP to grab information from just about any web page on the Internet. But where do those web pages come from? They come from other computers on the Internet called servers.

The Internet is full of clients (like you!) who ask for various resources (web pages, files, and so on), and servers, who store that information (or know where to get it). When you make an HTTP request, it zips through the Internet until it finds the server that knows how to fulfill that request. Then the server sends a response back to you!


Check out our fancy diagram in the editor. This is how clients and servers interact on the Internet! One server can handle many requests from several clients at once. (If the diagram is hard to see, you can resize the editor or console by clicking and dragging the lower border.) Click Save & Submit Code to continue!