-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
59 lines (46 loc) · 1.53 KB
/
script.js
File metadata and controls
59 lines (46 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
let url = 'https://poloniex.com/public?command=returnCurrencies';
async function getData() {
let request = await fetch(url);
let json = await request.json().catch();
showCurrencies(json);
}
getData();
function showCurrencies(json) {
$(function () {
let table = $('#mainTable');
let str = [];
for (let k in json) {
str.push('<tbody><tr><td id="id" scope="row">'
+ json[k].id + '</td><td>'
+ k + '</td><td id="name">'
+ json[k].name + '</td><td>'
+ json[k].humanType + '</td><td>'
+ json[k].currencyType + '</td><td>'
+ json[k].txFee + '</td><td>'
+ json[k].minConf + '</td>' +
'<td><button type="button" class="btn btn-dark" >Delete</button></td></tr>/tbody>');
}
table.append(str);
$("button").click(function (e) {
let tr = $(this).parent().parent();
tr.text('');
// Delete(json,id);
});
});
}
$(document).ready(function(){
$("#myInput").on("keyup", function() {
let value = $(this).val().toLowerCase();
$("#mainTable tbody tr ").filter(function() {
$(this).toggle($(this).children('#name').text().toLowerCase().indexOf(value) > -1);
});
});
});
// function Delete(json,id){
// for (k in json){
// if(json[k].id==id){
// json.splice(json[k],1);
// }
// }
// showCurrencies(json);
// }