Introduced big DB (~500 000 results) and multiple improvements

This commit is contained in:
Florian SYLVAIN
2021-10-29 15:11:09 +02:00
parent 4cfcf90ffc
commit 0f425bb06a
7 changed files with 71 additions and 28 deletions
+26
View File
@@ -0,0 +1,26 @@
function requestToApi(author) {
fetch(`api.php?author=${author}`)
.then(response => response.json())
.then(data => displayResults(data))
}
function displayResults(results) {
results.forEach(function(elem) {
let result = document.createElement('div')
result.classList.add('result-element')
let i = 0
elem.forEach(function(e) {
let child = document.createElement(i === 0 ? 'h1' : 'p')
child.innerText = e
result.appendChild(child)
i += 1
})
document.getElementById('results').appendChild(result)
})
}