-
Notifications
You must be signed in to change notification settings - Fork 79
/
index.html
39 lines (37 loc) · 958 Bytes
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<style>
.hidden {
display: none;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js"></script>
</head>
<body>
<h1>Spot The Bingo</h1>
<button id="grabmore">Fetch 10 Bingos</button>
<ul id="bingos">
</ul>
</body>
<script>
$(document).ready(function(){
let showRacks = function(racks){
$("#bingos").html('');
racks.map(rack=>{
$("#bingos").append(`<li>${rack.rack}: <span class="answer hidden">${rack.words}</span></li>`);
});
$("#bingos li").on("click", function(evt){
$(evt.currentTarget).find(".answer").toggleClass("hidden");
});
}
$("#grabmore").on("click", function(){
$.ajax({
method: "GET",
url: "api.php",
success: data=>{ showRacks(data)}
});
});
});
</script>
</html>