document.addEventListener(‘DOMContentLoaded’, function() {
const urlParams = new URLSearchParams(window.location.search);
const id = urlParams.get(‘id’);
document.getElementById(‘element-id’).textContent = id;
// Funcție pentru a încărca datele (exemplu)
function loadData(id) {
// Aici ar trebui să faci o cerere AJAX către server pentru a obține datele
// În acest exemplu, folosim date fictive
const data = {
„1”: { „nume”: „Ion”, „prenume”: „Popescu”, „email”: „[email protected]”, „telefon”: „0744123456” },
„2”: { „nume”: „Maria”, „prenume”: „Ionescu”, „email”: „[email protected]”, „telefon”: „0722654321” }
};
if (data[id]) {
const detalii = data[id];
const detaliiContainer = document.getElementById(‘detalii-container’);
detaliiContainer.innerHTML = `
Nume: ${detalii.nume}
Prenume: ${detalii.prenume}
Email: ${detalii.email}
Telefon: ${detalii.telefon}
`;
} else {
document.getElementById(‘detalii-container’).textContent = ‘Elementul nu a fost găsit.’;
}
}
loadData(id);
});