I use the database in JSON format, so I wrote the code that displays the goods on the page in a block with the id "masonry", but this code displays all the entries, how to make it so that it displays only 20 and then just the person presses the show button?
var ul = document.getElementById('masonry'); docfrag = document.createDocumentFragment(); //создаем каталог products.forEach(function(e) { var a = document.createElement("a"); a.className = "col-md-2 col-masonry product"; a.href = 'http://cheap-shopping.mega-mind.info/beta/product/?id=' + e.id; //div.style.position = "relative"; //div.style.marginTop = "20px"; a.innerHTML = '<div class="product-thumb"><header class="product-header"><img alt="'+ e.name +'" src="' +e.img +'"></header><div class="product-inner"><h5 class="product-title">' + e.name +'</h5><div class="product-desciption">' + e.miniAbout +'</div><div class="product-meta"><span class="product-time"></span><ul class="product-price-list"><li><span class="product-price">'+ e.price +' Грн.</span></li><li><a style="color: #858585" href="http://cheap-shopping.mega-mind.info/beta/sell/?id='+ e.id +'">Продать </a>-<a href="http://cheap-shopping.mega-mind.info/beta/product/?id='+ e.id +'"><span class="product-old-price"> Купить</span></a></li></ul></div><a href="http://cheap-shopping.mega-mind.info/beta/tag/?category='+ e.category +'"><p class="product-location"><i class="fa fa-tag"></i> '+ e.category +'</p></a></div></div> '; docfrag.appendChild(a); }); ul.appendChild(docfrag) ;
.forEachadd a counter, inside under the condition you do `if (cout <= 10) {/ * your code * /} else {/ * add a button * /} - Vasily Barbashev