Ajax is not a programming language. So what is it?

35

I'm asking this question because I've had enough of seeing things as requirements for a particular programming job:

  

You need to know the languages PHP, Javascript, CSS and AJAX

I've already learned that Ajax is not a programming language (of course, because no one "programs in Ajax").

But when it comes to the question of terms, how should we rank Ajax ? Resource? Technology? What should it be called?

    
asked by anonymous 02.03.2016 / 15:28

6 answers

44

Ajax is a "way" to use < in> XmlHttpRequest , which is not a language, but rather a Javascript API , as well as File API , DOM API , etc.

What XHR ( XmlHttpRequest API ) does is a client and server communication, not to say that it is asynchronous, since Ajax is the way to use XHR "asynchronously".

Synchronous XHR example (this is not Ajax):

var oReq = new XMLHttpRequest();

//Defina como false
oReq.open("GET", "/url", false);

//Espera completar a requisição, geralmente congela o browser
oReq.send(null);

alert(oReq.responseText);

Asynchronous XHR (ie Ajax) example:

var oReq = new XMLHttpRequest();

//Defina como true
oReq.open("GET", "/url", true);

//Função assíncrona que aguarda a resposta
oReq.onreadystatechange = function()
{
    if (oReq.readyState === 4) {
        alert(oReq.responseText);
    }
};

//Envia a requisição, mas a resposta fica sendo aguardada em Background
oReq.send(null);

Then Ajax means A synchronous J avaScript a nd X ML which translating is Javascript and XML asynchronous) and is the way to use the XHR that makes it Ajax or not. The term Ajax would be a nickname for the XHR used asynchronously.

It is important to note that synchronous mode has been nicknamed SJAX, meaning and J strong> nd X ML (synchronous Javascript and XML)), but note also that SJAX is out of use and modern browsers have started issuing Warnings on the console and will probably come to "block" this way, however within Web Workers because it runs in a separate thread, just as the error message says:

  

Synchronous xmlhttprequest on the main thread is deprecated

So in the main thread , which refers to the main thread running on the tab, the Web Works runs on sub-threads, which causes no problem, and in this case it is not in disuse.

More details on link

Another situation is that we do not always use XML, but at the time the nickname came up it was heavily used for supporting .resposeXML of XHR, to use Json today we have to do parse of .responseText .

    
02.03.2016 / 16:37
20

AJAX (Asynchronous Javascript and XML) is a technique that uses javascript to send asynchronous requests to a server, making pages and web systems (of the time and today) more interactive.

The term was wedged by Jesse James Garrett in 2005 in article Ajax: A New Approach to Web Applications

    
02.03.2016 / 15:33
15

To implement the Exchange Web Interface (OWA) without using page swapping to load new content, Microsoft created an interface in its MSXML component that allowed it to send a request over HTTP and receive an asynchronous response. At that time the bomb was XML and the interface was named XMLHttpRequest, but it does not in any way oblige the returned content to be XML.

Other browser developers adopted the interface and it exploded when Google launched Google Maps. Later it was packaged in JQuery which greatly facilitated its use of portability between browsers.

So, by answering the question, I think AJAX is better qualified as a technique than a technology . Certainly not a programming language. The technology would be the interface for asynchronous requests, which browsers did not originally support.

The full story is at Wikipedia , as always.

    
02.03.2016 / 15:52
12

AJAX Synchronous Ja vaScript and X ML, or Javascript and asynchronous XML) is a term used for asynchronous communication practices between a web application and a corresponding back-end.

In this definition, AJAX is a protocol (in the sense that it defines a behavior for data exchange), its implementation a channel (where requests are made and responses received ) and its use a practice (asynchronous requests and their processing).

    
02.03.2016 / 15:52
11

Being More Specify the Question:

  

AJAX is a JavaScript resource.

In which you can:

  • Refresh the webpage without reloading the page
  • Send data to a server - after the page has already been loaded.
  • Receive data from a server - after the page has already been loaded.
02.03.2016 / 16:01
3

It is a method or process for using Javascript and XML (or JSON) in communicating pages with users.

    
02.03.2016 / 15:32