AJAX

AJAX (Asynchronous JavaScript and XML) is used around the frontend to make requests to the backend and update the UI without refreshing the page.

We use the standard fetch() API to make requests.

Here a simple example:

const response =  await fetch('/!/gaia/account/wishlists', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json',
        'X-Requested-With': 'XMLHttpRequest',
        'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
    }
});