Last active
August 10, 2023 08:04
-
-
Save ParoTheParrot/919b81980b93e84d9eb817260e81b86c to your computer and use it in GitHub Desktop.
URL javascript fetcher #weather #html #javascript #test #chatgpt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>URL Intent Fetcher</title> | |
</head> | |
<body> | |
<div id="intentContent"></div> | |
<script> | |
// Get the div where we'll display the fetched content | |
const intentContentDiv = document.getElementById('intentContent'); | |
// URL to fetch | |
const url = 'https://wttr.in/?format=%l:+%m+%c+%C+%t+%f'; | |
// Fetch the content from the URL | |
fetch(url) | |
.then(response => response.text()) | |
.then(content => { | |
intentContentDiv.innerHTML = content; | |
}) | |
.catch(error => { | |
intentContentDiv.innerHTML = 'An error occurred: ' + error; | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment