MediaWiki:RecentActivities.js:修订间差异

来自东方活动维基
无编辑摘要
无编辑摘要
第4行: 第4行:
   if (xhr.readyState === 4) {
   if (xhr.readyState === 4) {
     if (xhr.status === 200) {
     if (xhr.status === 200) {
       var data = JSON.parse(xhr.responseText);
       let data = JSON.parse(xhr.responseText);
       //console.log(data);
       //console.log(data);
       data.forEach(e => {
       data.forEach(ele => {
       console.log(e)
       let name = ele["name"];
       })
      let id = ele["id"];
      let url = "https://touhou.market/main/events/" + id
       });
     } else {
     } else {
       console.error('Network response was not ok ' + xhr.statusText);
       console.error('Network response was not ok ' + xhr.statusText);

2024年6月3日 (一) 12:23的版本

var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://thonly.cc/proxy_thmarket/api/v1/events?include_pending=true&utf8=1', true);
xhr.onreadystatechange = function() {
  if (xhr.readyState === 4) {
    if (xhr.status === 200) {
      let data = JSON.parse(xhr.responseText);
      //console.log(data);
      data.forEach(ele => {
      	let name = ele["name"];
      	let id = ele["id"];
      	let url = "https://touhou.market/main/events/" + id
      });
    } else {
      console.error('Network response was not ok ' + xhr.statusText);
    }
  }
};
xhr.send();