fix
parent
1e40128bdf
commit
b59d7f2b30
|
@ -692,7 +692,8 @@
|
||||||
|
|
||||||
{% if offset %}
|
{% if offset %}
|
||||||
<script defer>
|
<script defer>
|
||||||
function loadMore(id) {
|
function loadMore(id, btn) {
|
||||||
|
const btn = document.getElementById(btn)
|
||||||
const el = document.getElementById(id)
|
const el = document.getElementById(id)
|
||||||
const form = new FormData();
|
const form = new FormData();
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
|
@ -702,13 +703,15 @@
|
||||||
xhr.onload=function(){
|
xhr.onload=function(){
|
||||||
if (xhr.status==200) {
|
if (xhr.status==200) {
|
||||||
el.innerHTML = xhr.response;
|
el.innerHTML = xhr.response;
|
||||||
|
btn.classList.toggle('hidden');
|
||||||
|
} else {
|
||||||
|
btn.disabled = false;
|
||||||
}
|
}
|
||||||
el.classList.toggle('hidden');
|
|
||||||
}
|
}
|
||||||
xhr.send(form)
|
xhr.send(form)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<button class="mt-2 w-full btn btn-gray" onclick="loadMore('comment-section'); this.disabled = true;">
|
<button class="mt-2 w-full btn btn-gray" id="load-more-button" onclick="loadMore('comment-section', this.id); this.disabled = true;">
|
||||||
Load more comments
|
Load more comments
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in New Issue