const xhr = new XMLHttpRequest;xhropenGET http1270018080抽卡记录json;xhronreadystatechange = function if xhrreadyState === 4 && xhrstatus === 200 const json = JSONparsexhrresponseText; const json
const xhr = new XMLHttpRequest(); xhr.open('GET', 'http://127.0.0.1:8080/抽卡记录.json'); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { const json = JSON.parse(xhr.responseText); const jsonList = document.getElementById('jsonList'); const jsonLutl = document.getElementById('jsonLutl'); const jsonLurl = document.getElementById('jsonLurl');
json.list.forEach(item => {
const li = document.createElement('li');
li.textContent = `${item.name} - ${item.item_type} - ${item.time}`;
if(item.rank_type=="5"){
li.classList.add("wuxin");
} else if(item.rank_type=="4"){
li.classList.add("sixing");
}
if(item.uigf_gacha_type=="301"){
jsonList.appendChild(li);
} else if(item.uigf_gacha_type=="302"){
jsonLutl.appendChild(li);
} else{
jsonLurl.appendChild(li);
}
});
} }; xhr.send()
原文地址: https://www.cveoy.top/t/topic/iHGT 著作权归作者所有。请勿转载和采集!