remotes/1693045480750635534/spooky-22
kek7198 2021-12-05 12:07:22 -06:00
parent d06f2772f2
commit d335ea4e9c
1 changed files with 5 additions and 5 deletions

View File

@ -693,8 +693,8 @@
{% if offset %} {% if offset %}
<script defer> <script defer>
function loadMore(id, trigger) { function loadMore(id, trigger) {
const btn = document.getElementById(trigger) const btn = document.getElementById(trigger) // trigger button
const el = document.getElementById(id) const el = document.getElementById(id) // target element to populate
const form = new FormData(); const form = new FormData();
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
@ -702,10 +702,10 @@
xhr.withCredentials=true; xhr.withCredentials=true;
xhr.onload=function(){ xhr.onload=function(){
if (xhr.status==200) { if (xhr.status==200) {
el.innerHTML = xhr.response; el.innerHTML = xhr.response; // replace desired element with response html
btn.classList.style('display: none'); btn.style.display = "none"; // hide button
} else { } else {
btn.disabled = false; btn.disabled = false; // enable our button if GET fails
} }
} }
xhr.send(form) xhr.send(form)