-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTML
More file actions
28 lines (27 loc) · 779 Bytes
/
Copy pathHTML
File metadata and controls
28 lines (27 loc) · 779 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
<!DOCTYPE html>
<html>
<head>
<title>Búsqueda eBay</title>
</head>
<body>
<h1>Buscar productos en eBay</h1>
<input type="text" id="query" placeholder="Buscar...">
<button onclick="buscar()">Buscar</button>
<div id="resultados"></div>
<script>
async function buscar() {
const q = document.getElementById('query').value;
const res = await fetch(`http://localhost:3000/buscar?q=${encodeURIComponent(q)}`);
const data = await res.json();
const cont = document.getElementById('resultados');
cont.innerHTML = data.map(p => `
<div>
<h3>${p.titulo}</h3>
<p>Precio: ${p.precio}</p>
<a href="${p.link}" target="_blank">Ver en eBay</a>
</div>
`).join('');
}
</script>
</body>
</html>