mirror of
https://github.com/Floriansylvain/projet_programmation_web.git
synced 2026-08-19 11:43:16 +02:00
🎨 Choosing a suggestion don't reload the page anymore
This commit is contained in:
@@ -68,12 +68,15 @@ function realTimeDisplay() {
|
|||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
suggestions.innerHTML = ""
|
suggestions.innerHTML = ""
|
||||||
data.forEach(elem => {
|
data.forEach(elem => {
|
||||||
let outsideTag = document.createElement('a')
|
|
||||||
outsideTag.href = "index.php?author=" + elem
|
|
||||||
let name = document.createElement('p')
|
let name = document.createElement('p')
|
||||||
name.innerHTML = elem
|
name.innerHTML = elem
|
||||||
outsideTag.appendChild(name)
|
name.addEventListener('click', () => {
|
||||||
suggestions.appendChild(outsideTag)
|
document.querySelector('#results-count').innerHTML = ""
|
||||||
|
document.querySelector('#results').innerHTML = ""
|
||||||
|
searchBar.value = elem
|
||||||
|
requestToApi(elem)
|
||||||
|
})
|
||||||
|
suggestions.appendChild(name)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,11 +115,7 @@ body {
|
|||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
cursor: pointer;
|
||||||
|
|
||||||
#suggestions a {
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#suggestions p:hover {
|
#suggestions p:hover {
|
||||||
|
|||||||
Reference in New Issue
Block a user