Skip to content

Instantly share code, notes, and snippets.

@ParoTheParrot
Last active August 10, 2023 08:04
Show Gist options
  • Save ParoTheParrot/919b81980b93e84d9eb817260e81b86c to your computer and use it in GitHub Desktop.
Save ParoTheParrot/919b81980b93e84d9eb817260e81b86c to your computer and use it in GitHub Desktop.
URL javascript fetcher #weather #html #javascript #test #chatgpt
<!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