catch (error) {
                status.innerHTML = `<div class="status error">Error: ${error.message}</div>`;
                response.textContent = `Request failed: ${error.message}`;
            } finally {
                button.disabled = false;
            }
        }

        // Clear response
        function clearResponse() {
            document.getElementById('status').innerHTML = '';
            document.getElementById('response').textContent = 'Response cleared. Ready for next request.';
       