Feature: #101970 - Ajax API accepts native URL and URLSearchParams objects as arguments

See forge#101970

Description

The Ajax API (@typo3/core/ajax/ajax-request) has been enhanced to accept native URL-related objects.

Impact

The constructor now accepts a URL object as argument, along with the already established string type. Also, the withQueryArguments() method accepts an object of type URLSearchParams as argument.

Example

import AjaxRequest from '@typo3/core/ajax/ajax-request.js';

const url = new URL('https://example.com/page/1/2/');
const queryArguments = new URLSearchParams({
    foo: 'bar',
    baz: 'bencer'
});

const request = new AjaxRequest(url).withQueryArguments(queryArguments);
request.get().then(/* ... */);
Copied!