I’ve got a static website hosted on Amazon S3 and I’m trying to figure out how to pull data from Airtable using their API. Most tutorials I find talk about using Node.js but I’m working with plain HTML/JS files.
Here’s my basic HTML structure (dashboard.html):
<!DOCTYPE html>
<html>
<head>
<title>Dashboard</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="main-wrapper">
<div class="content-area">
<div class="data-section">
<div id="api-results" class="full-width">
<!-- API data will go here -->
</div>
</div>
</div>
</div>
<script src="scripts/dashboard.js"></script>
</body>
</html>
When I try to use var Airtable = require('airtable'); in my JavaScript file (scripts/dashboard.js), I get an error saying require is not defined. Is there a way to connect to Airtable’s API using browser-based JavaScript without Node.js? What’s the proper approach for this setup?