27 lines
No EOL
857 B
JavaScript
27 lines
No EOL
857 B
JavaScript
$(document).ready(function () {
|
|
console.log("OK");
|
|
|
|
// $("#films").append(generateFilmCard("lorem", "lorem"));
|
|
|
|
$.get("http://localhost:8080/api/film", function (data) {
|
|
console.table(data);
|
|
|
|
for (let dataKey of data) {
|
|
$("#films").append(generateFilmCard(dataKey.name, dataKey.description));
|
|
}
|
|
});
|
|
});
|
|
|
|
function generateFilmCard(title, description) {
|
|
return `<div class="col">
|
|
<div class="border rounded color-border p-2">
|
|
<h5 class="title">${title}</h5>
|
|
<p class="description-4 mb-0">${description}</p>
|
|
|
|
<div class="d-flex">
|
|
<span class="me-auto text-muted">Il y a 20 minutes</span>
|
|
<span class="ms-auto text-muted">1h20min</span>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
} |