MilkScript

Automate tasks with MilkScript.

menu

global


fetch(url, options)

Fetches a resource from the network.

Parameters

url

The URL of the resource you want to fetch.

optionsOptional

The Options that you want to apply to the request.

Return value

The Response object.

Example

// Fetches a random quote from https://zenquotes.io
const response = fetch('https://zenquotes.io/api/random');
const [quote] = JSON.parse(response.getContentText());
console.info(`"${quote.q}"\n-- ${quote.a}`)