Skip to main content

Function: callService()

function callService<T>(
context,
siteUrl,
methodname,
args
): Promise<T>;

Defined in: core/ajax.ts:70

Calls one of Moodle's AJAX services as the logged-in person: a request to lib/ajax/service.php with the profile's session and its sesskey, as Moodle's pages make them, without a tab (ADR-004, ADR-011). Throws NotLoggedInError when there's no session, MoodleServiceError when the service fails.

Type Parameters​

Type Parameter
T

Parameters​

ParameterType
contextBrowserContext
siteUrlstring
methodnamestring
argsRecord<string, unknown>

Returns​

Promise<T>