Widget:Laad meer berichten: verschil tussen versies
Uit Dorpsbelang Den Hout
Regel 1: | Regel 1: | ||
<script>var offset=0; | <script>var offset=0; | ||
function loadMoreBerichten(set){ | function loadMoreBerichten(set){ | ||
− | + | ||
Regel 17: | Regel 17: | ||
</div> | </div> | ||
</div> | </div> | ||
− | |}}` | + | |}}`; |
− | + | offset += set; | |
var params = { | var params = { | ||
action: 'parse', | action: 'parse', |
Versie van 19 aug 2020 22:02
<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.querySelector('.fa-plus').closest('.row').insertBefore(newrow, document.querySelector('.fa-plus').closest('.col-md-6'))
newrow.innerHTML = data.parse.text['*'];
})
} </script>