What Is AJAX? Breaking it Down.

Alyssa E Easterly
2 min readAug 23, 2021
Photo by James Harrison on Unsplash

As any beginner programmer sets off on their journey it’s important to understand AJAX, and what it can do for you in your program. Let’s jump in!

AJAX is an acronym for Asynchronous Javascript and XML

AJAX allows you to update content on a web page without loading a new page. (Real life examples: Google maps- if you make a request it just adjusts/updates the current page, Twitter- Loads only a certain amount of posts if you keep scrolling down it will add more posts to the current page)

Some server-side languages AJAX works with include Python, PHP, Ruby, & Cold Fusion.

AJAX has been around since 1999, back then it wasn’t known as AJAX but as an XML HTTP Request Object(also sometimes shortened to XHR)

At its simplest, AJAX is the process of using Javascript to send a request to a web server, receive a response back, and then do something with that response.

Asynchronous

To understand the asynchronous part of an AJAX request: Asynchronous means making this request to the server won’t freeze your browser at a stand still when a request is made to the server, you can still click around and do things. What happens is your JavaScript program will keep running, only when a response comes back from the server will your program do something with it. It’s even possible to make multiple AJAX requests, you won’t know which response will come back first because of a couple factors: complexity of request, speed of the server, internet traffic

XML aka. Extensible Markup Language

Originally XML was seen as the format server responses should be sent in.

Things have changed a bit with XML and it is no longer the most popular or widely used format responses are sent in, oftentimes now we are now employing JavaScript to help us do the work.

How AJAX works:

  1. Create XML HTTP Object
  2. Define a callback function ( programming you want to run when program returns a response)
  3. Open a Request, this is where you define if the request method is a “get” or “post” request, and you also need to include the URL where the request is sent
  4. Send the Request.

Conclusion

I hope this gave you some insight into the basics of AJAX, and what it’s all about. Thanks for reading and happy hacking to you!

--

--