-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecairtable
40 lines (36 loc) · 1.14 KB
/
recairtable
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<script>
document.getElementById("form_submit").addEventListener("submit", async function (event) {
event.preventDefault();
await postData();
});
async function postData() {
const firstLow = document.getElementById("firstmember_lowPrice").value;
const firstHigh = document.getElementById("firstmember_hightPrice").value;
const secondLow = document.getElementById("secondmember_lowPrice").value;
const secondHigh = document.getElementById("secondmember_hightPrice").value;
let data = {
records: [
{
fields: {
"First Low": firstLow,
"First High": firstHigh,
"Second Low": secondLow,
"Second High": secondHigh,
},
},
],
};
await fetch("https://api.airtable.com/v0/appaNukibMwSkbUtp/tblTcv9uJfLLwK1se/", {
method: "POST",
body: JSON.stringify(data),
headers: {
"Content-type": "application/json",
Authorization: "Bearer keyW9wlscQjYRuR2l",
},
mode: "cors",
typecast: true,
})
.then((response) => response.json())
.then((json) => console.log(json));
}
</script>