역시나 부족해서인지 구현이 안됩니다.
부족하지만 답변 부탁드립니다.
<div class="container">
<button class="btn btn-danger" id="more">더보기</button>
</div>
<script>
var count = $('#more')
for(var count = 0; count < 3; count++) {
if(count == 1) {
$('#more').click(function(){
count++;
$.get('https://codingapple1.github.io/js/more1.json')
.done((data)=>{
data.forEach((a, i)=>{
var 템플릿 =
`<div class="col-sm-4">
< img src="https://via.placeholder.com/600" class="w-100">
<h5>${data[i].title}</h5>
<p>가격 : ${data[i].price}</p>
</div>`;
$('.row').append(템플릿)
})
});
});
else if(count == 2) {
$('#more').click(function(){
count++;
$.get('https://codingapple1.github.io/js/more2.json')
.done((data)=>{
data.forEach((a)=>{
var 템플릿 =
`<div class="col-sm-4">
< img src="https://via.placeholder.com/600" class="w-100">
<h5>${a.title}</h5>
<p>가격 : ${a.price}</p>
</div>`;
$('.row').append(템플릿)
})
});
});
});
};
</script>