-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
105 lines (102 loc) · 3.05 KB
/
Copy pathindex.html
File metadata and controls
105 lines (102 loc) · 3.05 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#2196f3" />
<title>IMDB CLONE</title>
<link
rel="stylesheet"
href="https://unpkg.com/bootstrap-material-design@4.1.1/dist/css/bootstrap-material-design.min.css"
integrity="sha384-wXznGJNEXNG1NFsbm0ugrLFMQPWswR3lds2VeinahP8N0zJw9VWSopbjv2x7WCvX"
crossorigin="anonymous"
/>
<style>
body {
font-family: fantasy;
background-color: lightblue;
}
</style>
</head>
<body class="container">
<h1 style="font-size: 80px; font-family: fantasy; text-align: center">
IMDB CLONE
</h1>
<h3 class="text-center">Get all the details of movie</h3>
<br />
<br />
<!-- take input -->
<input
style="border-bottom: 1px solid teal"
type="text"
class="form-control"
value="avengers"
id="searchTitle"
required
/>
<button
class="btn btn-warning btn-block bg-info text-white"
onclick="getMovie()"
>
Search
</button>
<div class="container">
<div class="row">
<div class="col-md-4">
<center>
<img
src=""
height="350"
width="230"
class="img-fluid"
alt=""
id="poster"
/>
</center>
</div>
<!-- displaying results -->
<div class="col-md-8" style="margin-top: 05px">
<p><b>Title</b><br /><i id="Title"></i></p>
<p><b>Actors</b><br /><i id="Actors"></i></p>
<p><b>Plot</b><br /><i id="Plot"></i></p>
<p><b>BoxOffice Collection ($)</b><br /><i id="BoxOffice"></i></p>
<p><b>Genre</b><br /><i id="Genre"></i></p>
<p><b>imdbRating</b><br /><i id="imdbRating"></i></p>
<p></p>
</div>
</div>
</div>
<!-- driver code -->
<script>
async function getMovie() {
// fetching details
var searchTitle = document.getElementById("searchTitle").value;
const api_url =
"https://omdbapi.com/?t=" + searchTitle + "&apikey=301346f3";
const response = await fetch(api_url);
const data = await response.json();
console.log(data);
const {
Title,
Actors,
Plot,
Poster,
BoxOffice,
Genre,
imdbRating,
} = data;
// put data to DOM
document.getElementById("Title").textContent = Title;
document.getElementById("Actors").textContent = Actors;
document.getElementById("Plot").textContent = Plot;
document.getElementById("poster").src = Poster;
document.getElementById("BoxOffice").textContent = BoxOffice;
document.getElementById("Genre").textContent = Genre;
document.getElementById("imdbRating").textContent = imdbRating;
console.log(searchTitle);
}
// call the function
getMovie();
</script>
</body>
</html>