diff --git a/src/static/script.js b/src/static/script.js index 30c3b6f532f638406a438c3cc2276b49c9ea27f9..71528b4f098eaaae086833c7f9c9cc80cd815400 100644 --- a/src/static/script.js +++ b/src/static/script.js @@ -105,14 +105,13 @@ function test(querystring) { champ_tier : champ.champ_tier }) }); - console.log(dict); - return dict; + addTable(dict) } }) } -function addTable(querystring) { - arr = test(querystring); +function addTable(arr2) { + arr = arr2 setTimeout(function(){ var myTableDiv = document.getElementById("myDynamicTable"); @@ -128,7 +127,7 @@ function addTable(querystring) { for (var j = 0; j < 4; j++) { var td = document.createElement('TD'); td.width = '75'; - td.appendChild(document.createTextNode(arr['0']['name'])); + td.appendChild(document.createTextNode(arr[j]['name'])); tr.appendChild(td); } } diff --git a/src/templates/index.html b/src/templates/index.html index 8a5cda69ca1445456a138ce0c4dc4c8f2e1a496e..beb30977865faffffaa3c811d18b1964473c9832 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -16,7 +16,7 @@ <button type = "button" onclick="handleGetChamp(field.value)" style="height:50px; width:720px">Get Champ</button><br><br><br><br> <label>Query (Ex : champion.win_rate: > 55):</label><br><br> <input type="text" id="field2" name="wr" style="height:50px; width:712px"><br><br> - <button type = "button" onclick="addTable(field2.value)" style="height:50px; width:720px">Get Query</button><br><br><br><br> + <button type = "button" onclick="test(field2.value)" style="height:50px; width:720px">Get Query</button><br><br><br><br> <button type = "button" onclick="clearValues()" style="height:50px; width:720px">Clear Results</button><br><br> </form> <table>