-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.html
More file actions
97 lines (85 loc) · 2.17 KB
/
search.html
File metadata and controls
97 lines (85 loc) · 2.17 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
<!DOCTYPE html>
<html>
<head>
<title>Search Results</title>
</head>
<style>
body {
font-family: Arial, sans-serif;
background-color: #130f40;
padding: 20px;
color: #ffffff;
}
h1 {
color: whitesmoke;
margin-left: 35%;
}
ul {
list-style: none;
padding: 0;
margin: 0;
background-color: #fff;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
border-radius: 5px;
margin-bottom: 20px;
}
li {
padding: 10px;
border-bottom: 1px solid #eee;
}
li:last-child {
border-bottom: none;
}
img {
max-width: 100%;
height: auto;
}
.back-button {
display: inline-block;
padding: 10px 20px;
background-color: #f2f2f2;
border: 1px solid #ccc;
border-radius: 4px;
cursor: pointer;
font-size: 20px;
text-decoration: none;
color: #130f40;
font-weight: bold;
}
.back-button:hover {
background-color: #e6e6e6;
}
.text {
color: black;
}
h1 {
margin-left: 42%;
}
</style>
<body>
<button class="back-button" onclick="goBack()">Back</button>
<h1>Search Results</h1>
<ul id="moviesList"></ul>
<script>
function goBack() {
window.history.back();
}
// Get the search results from the URL query parameter
const urlParams = new URLSearchParams(window.location.search);
const resultsParam = urlParams.get('results');
const movies = JSON.parse(decodeURIComponent(resultsParam));
const moviesList = document.getElementById('moviesList');
// Display each movie in the list
movies.forEach(movie => {
const li = document.createElement('li');
li.innerHTML = `
<h3 class="text">${movie.Title}</h3>
<p class="text">Year: ${movie.Year}</p>
<p class="text">Type: ${movie.Type}</p>
<img src="${movie.Poster}" alt="${movie.Title} poster">
`;
moviesList.appendChild(li);
});
</script>
</body>
</html>