-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.html
More file actions
108 lines (96 loc) · 4.11 KB
/
api.html
File metadata and controls
108 lines (96 loc) · 4.11 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
106
107
108
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./api.css">
<link rel="stylesheet" href="./icofont/icofont.min.css">
<link rel="stylesheet" href="./bootstrap.min.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN"
crossorigin="anonymous"></script>
<title>Document</title>
</head>
<body>
<header id="header">
<nav id="on" class="navbar navbar-expand-lg bg-body-tertiary fixed-top">
<div class="container-fluid">
<a class="navbar-brand" href="#">NONSOGLOBAL STORE</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarScroll"
aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarScroll">
<ul class="navbar-nav me-auto my-2 my-lg-0 navbar-nav-scroll" style="--bs-scroll-height: 100px;">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
CATEGORY
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">MEN CLOTHING</a></li>
<li><a class="dropdown-item" href="#">WOMEN CLOTHING</a></li>
<li><a class="dropdown-item" href="#">ELECTRONICS</a></li>
<hr>
<li><a class="dropdown-item" href="#">JEWELERY</a></li>
</ul>
</li>
<i id="cart" class="icofont-shopping-cart"></i>
</ul>
<form class="d-flex" role="search">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</div>
</nav>
</header>
<div id="show">
</div>
</body>
</html>
<script>
let theArr = ["Thier aray", "his array", "Her Array"]
fetch('https://dummyjson.com/products/search?q=phone')
.then(res => res.json())
.then(console.log);
// let screen = fetch("https://fakestoreapi.com/products")
fetch('https://dummyjson.com/products/')
.then(res => res.json())
.then(json => console.log(json))
let screen = document.getElementById("show")
fetch("https://fakestoreapi.com/products")
.then(res => res.json())
.then(json => {
console.log(json);
// screen.innerHTML = data.todo;
for (let index = 0; index < json.length; index++) {
const element = json[index];
screen.innerHTML += `
<div onclick="veiwitem(${element.id})" class="enn">
<img class="img" src="${element.image}" alt="">
<h1 class="non"> ${element.category}</h1>
<p id="cov" class="title"> ${element.title}</p>
<h2 class="price">$ ${element.price}</h2>
<p class="price"><i id="cert" class="icofont-ui-rate-blank"></i> ${element.rating.rate}</p>
<p class="price">${element.rating.count}</p>
<div class="cart">
<i class="icofont-cart"></i>
</div>
</div>
`
}
});
//.then(console.log);
function veiwitem(id){
console.log(id)
localStorage.setItem('productID', id)
window.location.href = "apishow.html"
}
</script>