function fetchApiData() { fetch('api/get') .then(response => response.text()) .then(data => document.getElementById('apiResult').textContent = data) .catch(error => document.getElementById('apiResult').textContent = 'Failed to fetch data'); } function fetchName() { fetch('name/get') .then(response => response.text()) .then(data => document.getElementById('nameResult').textContent = data) .catch(error => document.getElementById('nameResult').textContent = 'Failed to fetch name'); }