cecko

Untitled

Jun 25th, 2023
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. function attachEvents() {
  2.  
  3. let location = document.getElementById('location');
  4. let submitBtn = document.getElementById('submit');
  5. let forecast = document.getElementById('forecast')
  6.  
  7. let url = 'http://localhost:3030/jsonstore/forecaster/locations'
  8.  
  9. submitBtn.addEventListener('click', async function () {
  10. const response = await fetch(url);
  11. let data = await response.json();
  12. forecast.style.display = 'block';
  13. })
  14.  
  15. }
  16.  
  17. attachEvents();
Advertisement
Add Comment
Please, Sign In to add comment