DayPilot.Http.get

The DayPilot.Http.get() method makes an HTTP request to the specified URL using GET method. 

The syntax and behavior is inspired by axios.

Declaration

DayPilot.Http.get(url[, options]);

Parameters

  • options.headers - an object with header values

Return Value

The DayPilot.Http.get() method returns a promise. If the HTTP response status code is 200, 201, 204 or 304 the promise is resolved, otherwise it is rejected.

The success handler receives an args object as an argument:

  • args.request - XMLHttpRequest object used for making the request
  • args.data - event data received from the server, converted from JSON to object using JSON.parse()

The error handler receives an args object as an argument:

  • args.request - XMLHttpRequest object used for making the request

Example

const {data} = await DayPilot.Http.get("/events");
console.log("data", data);