Commit 3aa4500c authored by Daniel Witek's avatar Daniel Witek

added types to results

parent 8a4a6dec
......@@ -32,7 +32,7 @@ searchButton.addEventListener("click", search, false)
function search(e) {
e.preventDefault();
const searchValue = document.getElementById('input').value
// console.log(searchValue);
console.log(searchValue);
sendNameQuery(searchValue);
}
......@@ -46,7 +46,7 @@ function search(e) {
// })
function sendNameQuery(q){
var query = "q=poke_txt_en:" + q +"&rows=100" //rows ist nötig, sonst nur 10 results
var query = "q=poke_txt_en:(" + q +")&rows=100" //rows ist nötig, sonst nur 10 results
console.log(query);
client.search(query,function(err,obj){
if(err){
......@@ -64,11 +64,28 @@ function sendNameQuery(q){
"<li>Id: <strong>" + results[i].id + "</strong></li>" +
"<li>Name: <strong>" + results[i].poke_txt_en + "</strong></li>" +
"<li>Gen: " + results[i].gen_txt_en + "</li>" +
"<li>HP: " + results[i].maxHP_txt_en + "</li>"
"<li>HP: " + results[i].maxHP_txt_en + "</li>" +
"<li>Types:</li>" +
"<ul id='test'></ul>"
document.getElementById('results').appendChild(item)
let types = results[i].types_features
console.log(types)
// let item2 = document.createElement("ul")
// item2.setAttribute("id", "test");
// document.getElementById('results').appendChild(item2)
for (var i = 0; i < types.length; i++) {
let item3 = document.createElement("li")
// console.log(types[i])
item3.innerHTML = types[i];
document.getElementById('test').appendChild(item3)
// item2.appendChild(item3);
}
}
console.log(obj);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment