Widget:Laad meer berichten

Uit Dorpsbelang Den Hout
Ga naar:navigatie, zoeken

<button class="btn" onclick="loadMoreBerichten()" >Laad meer</button> <script>var offset=0; function loadMoreBerichten(set){


 var wikitext = `... meer resultaten`;
 offset += set;
  var params = {
               action: 'parse',
               text: wikitext,
               contentmodel: 'wikitext',
               format: 'json'
             },
            api = new mw.Api();
            api.post( params ).done( function ( data ) {
               console.log(data.parse.text['*'])
              var newrow = document.createElement('div');
             // newrow.classList.add('row')
           //   document.body.appendChild(newrow);
             
               newrow.innerHTML = data.parse.text['*'];
              newrow.querySelectorAll('.col-md-6').forEach(function(el){
              
               document.querySelector('.fa-plus').closest('.row').insertBefore(el, document.querySelector('.fa-plus').closest('.col-md-6'))
              })
              
              
            })
 

} </script>