Javascript - Ajax (Asynchronous JavaScript And XML)

> (World Wide) Web - (W3|WWW) > Javascript (Js|ECMAScript)

1 - 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:

Advertising

3 - Management

3.1 - See

In the Browser devtool, you can see the request.

Example with Chrome.

chrome_devtool_xhr_fetch_request.jpg

4 - Library

4.1 - Jquery

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

$.ajax({
  url: "https://gerardnico.com/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>

Advertising

4.2 - PJax

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

4.3 - Axios

4.4 - Super Agent

4.5 - Web API Fetch

4.6 - React

5 - Documentation

Advertising
web/javascript/ajax.txt · Last modified: 2019/04/14 14:25 by gerardnico