I have video channel that I want to display all the the related video in that page. I displayed it from left to the right. But now I got problem with the same data appear twice left and right in one div. I know this is wrong but how do I corrected it ?
This is the current output that I got with my code
below is what I have tried
onst display = (id) => {
axios.get(`${url}category?=${id}`)
.then(function(res) {
if (res.data.status == 'success') {
res.data.result.map((e) => {
$("video1").append(`
<div class="nk-block">
<div class="row g-gs">
<div class="col-xl-6">
<div class="card card-bordered h-100">
<div class="card-inner">
<div class="align-end gy-3 gx-5 flex-wrap flex-md-nowrap flex-xl-wrap">
<div class="nk-sale-data-group flex-md-nowrap g-4">
<iframe width="430" height="300" src="${e.video}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
</div>
<div class="card-title-group align-start mb-2" style="margin-top: 30px;">
<div class="card-title" style="margin-bottom: 0px;"><h6 class="title">${e.title}</h6></div>
</div>
</div>
</div>
</div>
<div class="col-xl-6">
<div class="card card-bordered h-100">
<div class="card-inner">
<div class="align-end gy-3 gx-5 flex-wrap flex-md-nowrap flex-xl-wrap">
<div class="nk-sale-data-group flex-md-nowrap g-4">
<iframe width="430" height="300" src="${e.video}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
</div>
<div class="card-title-group align-start mb-2" style="margin-top: 30px;">
<div class="card-title" style="margin-bottom: 0px;"><h6 class="title"> ${e.title} </h6></div>
</div>
</div>
</div>
</div>
</div>
</div>`);
});
}
});
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="video1"></div>
How do I achieve output like this and prevent it form duplicating it ?
My main concern is how do I display different video on left and right column. With my current code, left and right column sit on in the same div. That's the reason why I think it produce the same output.
<div class="nk-block">
<div class="row g-gs">
//left column
<div class="col-xl-6"></div>
//right column
<div class="col-xl-6"></div>
</div>
</div>
example of data inside my API
"status": "success",
"result": [
{
"id": 35,
"title": "Tutorial 1",
"video": "https://www.youtube.com/watch?v=W6NZfCO5SIk&ab_channel=ProgrammingwithMosh"
},
{
"id": 37,
"title": "Tutorial 2",
"video": "https://www.youtube.com/watch?v=pTB0EiLXUC8&ab_channel=ProgrammingwithMosh"
},
{
"id": 48,
"title": "Tutorial 3",
"video": "https://www.youtube.com/watch?v=8TnBZ8rom9c&ab_channel=ProgrammingwithMosh"
}
]
for
loop to iterate two items at a time