-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject2pg2.html
More file actions
74 lines (70 loc) · 1.81 KB
/
Project2pg2.html
File metadata and controls
74 lines (70 loc) · 1.81 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
Body{
background-color: tomato; font-size: 34px; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
</style>
<h2> Delightful Dishes Search</h2>
</head>
<img src="_imgmeatballs.jpg">
<img src="_imglasagna.jpg">
<img src="_imgeggplant.jpg">
<img src="_imgpizza.jpg">
<img src="_imgblog2.jpg">
<img src="_imgchickenandwaffles.jpg">
<img src="_imgsuasage.jpg">
<img src="_imgoysters.jpg">
<img src="_imgbeefpasta.jpg">
<img src="_imgstromboli.jpg">
<img src="_imgbreakfast.jpg">
<img src="_imgsandwich.jpg">
<img src="_imggarliccrabs.jpg">
<img src="_imgblog.jpg">
<h3> So many wonderful varieties of the best type of food to try.</h3>
<h4> These foods are the best in town, and alot have simple recipes that you can even prepare in the comfort of your home.</h4>
</h3>
<body>
<input id="search"
type="search"/>
<Button
id="select a dish">select a dish</Button>
</body>
<script>
/*
As a user I want to be able to:
- type in text
- click select a dish
- view dishes on page
From the technical side:
- detect when select a dish clicked
- grab user input
- use user input in our api call
- parse the response
- display data accordingly
*/
$(document).ready(
()=>{
$("#select a dish").click(()=>{
let user input = $("search").val()
alert(userInput)
})
$.ajax})
url:"http://www.developers.giphy.com/?
apikey=[n8NF4wimelBAeszfef5CE6KA8SI2NZoA]${userInput}
.done((res)=>{
let dishes = res.Search;
$.each(dishes, (i, e=>{
let img = e.Img
console.log("Img", img)
})
$("body").append('<img
src="${Img}" alt="dish img"/>')
})
})
</script>
</html>