Visitar URL original
feat: type ahead · tiago-m-dias/JavaScript30@4701482 · GitHub
Skip to content

Commit 4701482

Browse files
committed
feat: type ahead
Challenge wesbos#6 get data using fetch
1 parent 7528b7c commit 4701482

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

‎06 - Type Ahead/index-START.html‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
<!DOCTYPE html>
22
<html lang="en">
3+
34
<head>
4-
<meta charset="UTF-8">
5-
<title>Type Ahead 👀</title>
6-
<link rel="stylesheet" href="style.css">
5+
<meta charset="UTF-8">
6+
<title>Type Ahead 👀</title>
7+
<link rel="stylesheet" href="style.css">
78
</head>
9+
810
<body>
911

10-
<form class="search-form">
11-
<input type="text" class="search" placeholder="City or State">
12-
<ul class="suggestions">
13-
<li>Filter for a city</li>
14-
<li>or a state</li>
15-
</ul>
16-
</form>
17-
<script>
18-
const endpoint = 'https://gist.githubusercontent.com/Miserlou/c5cd8364bf9b2420bb29/raw/2bf258763cdddd704f8ffd3ea9a3e81d25e2c6f6/cities.json';
12+
<form class="search-form">
13+
<input type="text" class="search" placeholder="City or State">
14+
<ul class="suggestions">
15+
<li>Filter for a city</li>
16+
<li>or a state</li>
17+
</ul>
18+
</form>
19+
<script>
20+
const endpoint = 'https://gist.githubusercontent.com/Miserlou/c5cd8364bf9b2420bb29/raw/2bf258763cdddd704f8ffd3ea9a3e81d25e2c6f6/cities.json';
1921

20-
</script>
22+
const cities = [];
23+
fetch(endpoint).then(rawData => rawData.json()).then(data => console.log(data));
24+
</script>
2125
</body>
22-
</html>
26+
27+
</html>

0 commit comments

Comments
 (0)