Skip to content

Commit

Permalink
Add search for user #11
Browse files Browse the repository at this point in the history
  • Loading branch information
ussiemer committed Apr 19, 2024
1 parent cfc4fee commit 3187609
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,28 @@

function displayResults(results) {
const container = document.getElementById('searchResults');
container.innerHTML = ''; // Clear previous results
container.innerHTML = '';

results.forEach(result => {
const link = document.createElement('a');
link.href = "#";
link.textContent = result.username;
link.classList.add('user-link');

// Event listener for clicking on each user link
link.addEventListener('click', function(event) {
event.preventDefault();
// Call your function to fetch all items, generate the graph, and init it
loadGraph(result.id);
});

// Append the link to a div container (for styling or additional structure)
const div = document.createElement('div');
div.textContent = result.username; // Assuming the 'username' is part of the returned data
div.appendChild(link);
container.appendChild(div);
});
}

</script>


Expand Down

0 comments on commit 3187609

Please sign in to comment.