Ajax enables us to communicate with the server, access a file or a database there, and come back to our page and alter its contents without reloading the page. Often Ajax is also used to send data from the page (often from a form) to a script on the server, and often the server-side script will then access a database.
Here is an example using Ajax to get data out of a file on the server.
Ajax is probably going to be replaced by Fetch in the near future. Here is the same example done with Fetch instead of Ajax.