async function getQrCode(data) {
try {
const response = await fetch(`https://api.globus.studio/v2/qr?data=${encodeURIComponent(data)}&type=png&size=5`);
if (!response.ok) {
throw new Error('Network response was not ok');
}
const blob = await response.blob();
const url = URL.createObjectURL(blob);
const img = document.createElement('img');
img.src = url;
img.alt = 'QR Code';
document.body.appendChild(img);
} catch (error) {
console.error('Error fetching QR code:', error);
}
}
getQrCode('Hello, World!');