document.addEventListener("DOMContentLoaded", function() { fetch("../php/conciertos.php") .then(response => response.json()) .then(data => { let div = document.getElementById("conciertos"); div.innerHTML = ""; // Limpiar contenido previo if (data.length === 0) { div.innerHTML = "
No hay conciertos disponibles.
"; return; } data.forEach(concierto => { let evento = document.createElement("div"); evento.classList.add("concierto"); evento.innerHTML = `Artista: ${concierto.artista}
Ubicación: ${concierto.direccion}
Fecha: ${concierto.fecha} - ${concierto.hora}
`; div.appendChild(evento); }); }) .catch(error => console.error("Error cargando conciertos:", error)); }); // Función para redirigir a la compra de boletos function comprarBoletos(conciertoId) { window.location.href = `venta_boletos.html?concierto_id=${conciertoId}`; }