Table of Contents

About

Asynchronous Javascript and XML (Ajax) is just a name umbrella to talk about a technology that retrieve data from a server asynchronously.

The term Ajax has evolved to accept request transporting other data than XML such as JSON text or dead plain text

Every Ajax call is using:

In 1998, the Microsoft Outlook team invented the XMLHttpRequest and, the year after, snuck it into Internet Explorer 5.0. All the browsers followed and the era of AJAX was born.

Management

See

In the Browser devtool, you can see the request.

Example with Chrome.

Chrome Devtool Xhr Fetch Request

Library

Native

Web API Fetch

Browser - Web API - Fetch function

Web Api XHR

Browser - XMLHttpRequest (XHR) API

Non-Native

Jquery

Jquery example. https://api.jquery.com/jQuery.ajax/

$.ajax({
  url: "/doc/api/weather",
  data: {
    zipcode: 2343
  },
  success: function( result ) {
    $( "#weather-temp" ).html( "<strong>" + result + "</strong> degrees" );
  }
});
  • The HTML
The temperature is <span id="weather-temp"></span>

PJax

See also: Pjax that supports browsing history with Ajax call.

Axios

https://github.com/axios/axios

Super Agent

https://github.com/visionmedia/superagent

React

React Class Component - Fetch (Ajax)

Documentation