I tried this, but all I get when I test the script is:
ERROR
ReferenceError: require is not defined
at main on line 5
Sorry, Luke, it was my mistake; the Airtable script editor does not support the require() function, so you can't use it to include the jQuery library in your script.
Use the fetch() or XMLHttpRequest() JavaScript built-in functions to make your requests.
Here's an example of how you can use the fetch() function to make a GET request to the Google Calendar API to retrieve events for a specific calendar:
var calendarId = 'primary';
var apiKey = 'YOUR_API_KEY';
fetch(`https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events?key=${apiKey}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
// Do something with the data
console.log(data);
})
.catch(error => {
console.error(error);
});
Thank you.