Confused about what AJAX is


This is probably a stu:;@$t question or something I should know by now but I dont, sorry.

What is AJAX?

I thought AJAX was some sort of mix of JavaScript and XML but after looking at the article below I started wondering if pure JavaScript or jQuery could be considere Ajax?

Can someone explain this a little?


In it’s essence AJAX is a technique javascript uses to download and process information from a web server without needing to refresh the page.

jQuery has methods to use AJAX, but jQuery can by no means be considered to be the same as AJAX (apples and oranges).

AJAX is an answer to a problem faced with standard web pages.

What is that problem? It’s where actions that you perform on a web page cause the entire page to unload, and a new page to be loaded. When you click a link you are taken to a new page. When you submit a form you are taken to either a new page, or a completely new version of the same page.

The problem is that the existing page contents cannot remain, while information is communicated in the background, or content is transferred so that you can perform an update to only a small part of the page.

[list][]Aysynchronous means you can send data or make requests from the server without needing to reload the entire page
]Javascript is the language that you use to perform those data requests
[]And that data is commonly transferred as JSON or
]XML data[/list]

It is the technique of using that asynchronous communication which makes up fundamental core of what AJAX is.

A resource that has proven to be very useful when writing your own AJAX code is the Bulletproof Ajax book, which also provides [url=“”]code and working examples.

Thank you both for the good explanation!

So this means that AJAX uses some sort of a middle program to comunicate between the server, XML and JavaScript?

Only javascript is used as the communicating program. The data that is sent back and forth is only a string, so you can use XML, or JSON, or HTML, or plain text, each one depending on the intended use.

JSON is becoming the more popular communication format now for data structures, due to its the ease of use, and relatively small size compared to XML.

Starting to make sense, thanks a lot!