-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
29 lines (26 loc) · 943 Bytes
/
app.js
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
function createNode(element) {
return document.createElement(element);
}
function append(parent, el) {
return parent.appendChild(el);
}
const place = document.getElementById('airbnb');
fetch('https://api.sheety.co/30b6e400-9023-4a15-8e6c-16aa4e3b1e72')
.then(res => res.json())
.then(data => {
data.forEach(places => {
let div = createNode('div'),
p = createNode('p'),
img = createNode('img'),
type = document.createTextNode(places["property_type"] + "\n"),
name = document.createTextNode(places["name"]),
price = document.createTextNode("\nPreço: $" + places["price"] + " / noite");
img.src = places["photo"];
append(div, img);
append(div, type);
append(div, p);
append(p, name);
append(div, price);
append(place, div);
})
});