What’s in an AJAX call?

July 3, 2014

So, you’ve made your first AJAX call. You got some data back. Maybe you made a web app.

Congratulations!

I know that in the beginning of coding it often happens that someone tells you “Here, just do this this way. It works.” The keen new developer may be screaming “BUT WHY DOES IT WORK!? WHAT IS IT!? HOW CAN I APPLY THIS KNOWLEDGE GOING FORWARD!?”

Let me try to answer.

What is AJAX?
AJAX is not a single technology or an application. It is a group of technologies being used to together to perform a specific task. Here’s a very succinct list of AJAX’s component parts from Jesse James Garrett’s 2005 article on AJAX:whatisajax
What does AJAX do?
Basically, AJAX makes it possible to make requests to a server and update a page without a full page refresh. It keeps the user’s experience continuous while allowing the page to be dynamically changed.

What does AJAX stand for?
Asynchronous Javascript And XML

What is asynchronicity?
JavaScript executes down the page. The browser starts reading at the top of your code and if a condition is not met for the execution of some bit of code, the browser skips it. If a piece of code is dependent on another, they better be in order. Asynchronicity is the capacity to execute an piece of code in a different order than it’s written.

Why JavaScript?
The fun of AJAX is that the information returned can be dynamically added to your page. Using JavaScript. JavaScript is the glue that holds everything together; the general who directs and commands everyone.

Why XML?
Totally by convention. XML is a data format. JSON is a data format. Using JSON is more common than XML right now but most people still say AJAX even though it’s more accurate to say AJAJ.

So, what’s an AJAX call?
It’s when your web page sends a request to a server for some information, which will be returned to you in XML or JSON (or another) format.

Most commonly, you’re gonna use AJAX to request data. You can also send data, but don’t worry about that for now.

I still don’t get it.
No big! Ask a question or read these articles:
Ajax: A New Approach to Web Applications (2005)
What’s a callback? (Wikipedia)
What’s an XMLHttpRequest? (W3C Schools, 2014)
This seems to be the only article out there on the differences between AJAX/AHAH/AJAH/AJAJ (2010)

Tell me what you think!

Categorised in: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>