-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrendingCollection.jsp
More file actions
executable file
·32 lines (28 loc) · 908 Bytes
/
Copy pathtrendingCollection.jsp
File metadata and controls
executable file
·32 lines (28 loc) · 908 Bytes
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
<jsp:include page="userDashboard.jsp" />
<div class="text-center m-3">
<div class="btn btn-lg btn-primary">Trending Movies</div>
</div>
<table class="table" style="margin-top:50px ;">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Movie Name</th>
</tr>
</thead>
<tbody id="table">
</tbody>
</table>
<script>
let arr = []
fetch('https://api.themoviedb.org/3/trending/all/week?api_key=08a5daac2572af0da29de06e195c356d&language=en-US')
.then((response) => response.json())
.then((data) => {
let array = []
for(let i=0;i<15;i++){
let t = data['results'][i]?.title || data['results'][i]?.name || data['results'][i]?.original_name
document.getElementById("table").innerHTML+="<tr><th>"+(i+1)+ "</th> <td >"+t+"</td> </tr>"
array.push(`${t}`);
}
console.log(array);
});
</script>