Commit 8a4a6dec authored by Daniel Witek's avatar Daniel Witek

added more stats

parent 5ead24b6
......@@ -33,7 +33,7 @@ function search(e) {
e.preventDefault();
const searchValue = document.getElementById('input').value
// console.log(searchValue);
sendQuery(searchValue);
sendNameQuery(searchValue);
}
// $('searchForm').submit(function(){
......@@ -45,8 +45,8 @@ function search(e) {
// // return false
// })
function sendQuery(q){
var query = "q=poke_txt_en:" + q +"&rows=100"
function sendNameQuery(q){
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){
......@@ -58,16 +58,18 @@ function sendQuery(q){
}
for(var i = 0; i < results.length; i++){
let item = document.createElement("li")
let item = document.createElement("p")
item.innerHTML = "<strong>" + results[i].poke_txt_en + "</strong>"
document.getElementById('results').appendChild(item)
item.innerHTML =
"<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>"
document.getElementById('results').appendChild(item)
}
// let countResult = obj.numFound;
// console.log(countResult)
// const Count = countResult[1]
// document.getElementById('results').innerHTML = Count;
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