38 lines
1.5 KiB
HTML
38 lines
1.5 KiB
HTML
<div class="modal fade" id="detailModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
|
|
aria-hidden="true">
|
|
<div class="modal-dialog modal-lg modal-dialog-scrollable" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title text-center" id="details-title">Modal title</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div id="details-intro"></div>
|
|
<div id="details-description"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
$('#detailModal').on('show.bs.modal', function (event) {
|
|
let card = $(event.relatedTarget); // Button that triggered the modal
|
|
{#let name = card.data('name'); // Extract info from data-* attributes#}
|
|
let post_id = card.data('post_id');
|
|
|
|
$.post(`/api/post/${post_id}`, data => {
|
|
if (!data.success) {
|
|
console.error("No data for post");
|
|
return;
|
|
}
|
|
let modal = $(this);
|
|
console.log(data);
|
|
modal.find('#details-title').text(data.post.title);
|
|
modal.find('#details-intro').text(data.post.intro);
|
|
modal.find('#details-description').text(data.post.description);
|
|
|
|
});
|
|
})
|
|
</script> |