forked from yeshwanthlm/Serverless-Web-Application-on-AWS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
18 lines (16 loc) · 581 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const form = document.querySelector('form');
const greeting = document.querySelector('#greeting');
form.addEventListener('submit', (event) => {
event.preventDefault();
const name = document.querySelector('#name').value;
greeting.textContent = `Hello, ${name}!`;
});
const counter = document.querySelector(".counter-number");
async function updateCounter() {
let response = await fetch(
"https://o73g5ptpujgtclinhzhhneplje0jogoh.lambda-url.us-east-1.on.aws/"
);
let data = await response.json();
counter.innerHTML = `Views: ${data}`;
}
updateCounter();