v7.3.0

AjaxHelper

A static utility class that simplifies Ajax requests using the browser's Fetch API. It provides convenience methods for common HTTP verbs (GET, POST) and returns standard Response promises. Global defaults can be set via DEFAULT_FETCH_OPTIONS.

const response = await AjaxHelper.get('some-url');
const data     = await response.json();

Uploading a file to the server via FormData:

const formData = new FormData();
formData.append('file', 'fileNameToUpload');
AjaxHelper.post('file-upload-url', formData).then(response => {
    // process request response here
});

Useful functions

Function Description
get Perform a GET request
post Perform a POST request
fetch Perform a request with any HTTP method

See also

  • AjaxStore - Store that uses AjaxHelper for remote data loading
  • FetchOptions - Options object passed to fetch methods
No results

Properties

Properties are getters/setters or publicly accessible variables on this class

    Functions

    Functions are methods available for calling on the class

      Type definitions

      Source path

      Core/helper/AjaxHelper.js

      Contents