Skip to content

Instantly share code, notes, and snippets.

@andreburto
Created June 14, 2025 03:08
Show Gist options
  • Save andreburto/323b3b1f1ad898297da626c3bd3bda14 to your computer and use it in GitHub Desktop.
Save andreburto/323b3b1f1ad898297da626c3bd3bda14 to your computer and use it in GitHub Desktop.
Copilot generated html page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTTP Request Buttons</title>
</head>
<body>
<h1>HTTP Request Buttons</h1>
<button id="putButton">Put</button>
<button id="getButton">Get</button>
<button id="deleteButton">Delete</button>
<script>
// Define the global constant for the endpoint URL
const endPointUrl = 'https://example.com/api';
// Function to make an HTTP request
function makeRequest(method) {
fetch(endPointUrl, { method })
.then(response => response.text())
.then(data => console.log(`${method} Response:`, data))
.catch(error => console.error(`${method} Error:`, error));
}
// Add event listeners to the buttons
document.getElementById('putButton').addEventListener('click', () => makeRequest('PUT'));
document.getElementById('getButton').addEventListener('click', () => makeRequest('GET'));
document.getElementById('deleteButton').addEventListener('click', () => makeRequest('DELETE'));
// Timer to make a GET request every 30 seconds
setInterval(() => makeRequest('GET'), 30000);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment