-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloop-Example.txt
38 lines (33 loc) · 1.39 KB
/
loop-Example.txt
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
//product-catalog.php
<h1>Product Catalog</h1>
<div id="cards-container" class="cards-container">
</div>
<script src="/js/models/Product.js"></script>
<script>
Ajax('POST', '/api/Product/Read',
null,
function (resp) {
if (ErrorInResponse(resp)) {
return false;
}
const cardsContainer = $('#cards-container')
//loop easy example
for (let p of resp.data) {
let html = `
<img src="/api/Product/Image/${p.image}" alt="${this.product}" /><br>
Product id ${p.product_id}<br>
Category id ${p.category_id}<br>
Category ${p.category}<br>
Product Name ${p.product}<br>
Product description ${p.description}<br>
Price ${eur}${p.price}<br>
Quantity ${p.quantity}<br>
Status ${p.status}<br>
<p class="added">Added: ${p.date_added.toLocaleString('de-AT')} <a class="specs" href="/Product-Specs/${p.product_id}">Specs</a></p>`
let card = document.createElement('div')
card.className = 'card'
card.innerHTML = html
cardsContainer.appendChild(card)
}
});
</script>