fetch('https://api.medanpedia.co.id/services', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ api_id: 17427, api_key: 'n7arvt-umgbdd-5d68pu-kxjrvu-z9l7rq', service_fav: 1 }), }) .then(response => { console.log('Raw Response:', response); return response.json(); }) .then(data => { console.log('Parsed Data:', data); // Cetak data untuk debugging if (data.status) { let output = ''; data.data.forEach(service => { output += `

${service.name}

Category: ${service.category}

Price: Rp${service.price}

Min Order: ${service.min}

Max Order: ${service.max}

Refill: ${service.refill ? 'Yes' : 'No'}

Average Time: ${service.average_time}

Description: ${service.description}


`; }); document.getElementById('output').innerHTML = output; } else { document.getElementById('output').innerHTML = `

Error: ${data.msg}

`; } }) .catch(error => { console.error('Error:', error); document.getElementById('output').innerHTML = '

Failed to fetch data from API.

'; });

We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. By continuing to use our site, you agree to our use of cookies. You can learn more about how we use cookies and how you can control them by visiting our Privacy Policy.