MediaWiki:Timeless.js: mudanças entre as edições
De RubinOT Wiki
Sem resumo de edição |
Sem resumo de edição |
||
Linha 3: | Linha 3: | ||
console.log('Document is ready, calling fetchData...'); | console.log('Document is ready, calling fetchData...'); | ||
fetchData(); | fetchData(); | ||
fetchData1(); | |||
}); | }); | ||
}); | }); | ||
Linha 31: | Linha 33: | ||
$('#world4').text(worlds[3].playesr); | $('#world4').text(worlds[3].playesr); | ||
$('#world5').text(worlds[4].playesr); | $('#world5').text(worlds[4].playesr); | ||
} | |||
function fetchData1() { | |||
console.log('fetchData function called'); | |||
var urla = 'https://rubinot.net/webservices/worlds.php'; | |||
$.ajax({ | |||
urla: urla, | |||
method: 'GET', | |||
dataType: 'json', | |||
success: function(data) { | |||
console.log(data); // Exibe o conteúdo no console | |||
insertPlayerWorlds(data); | |||
}, | |||
error: function(jqXHR, textStatus, errorThrown) { | |||
console.error('There has been a problem with your fetch operation:', textStatus, errorThrown); | |||
} | |||
}); | |||
} | |||
function insertPlayerWorlds1(worlds) { | |||
// Assuming you have specific container elements for each world | |||
$('#worldgringo').text(worlds[0].players); | |||
} | } |
Edição das 17h43min de 17 de maio de 2024
mw.loader.using('jquery', function() { $(document).ready(function() { console.log('Document is ready, calling fetchData...'); fetchData(); fetchData1(); }); }); function fetchData() { console.log('fetchData function called'); var url = 'https://rubinot.com.br/webservices/worlds.php'; $.ajax({ url: url, method: 'GET', dataType: 'json', success: function(data) { console.log(data); // Exibe o conteúdo no console insertPlayerWorlds(data); }, error: function(jqXHR, textStatus, errorThrown) { console.error('There has been a problem with your fetch operation:', textStatus, errorThrown); } }); } function insertPlayerWorlds(worlds) { // Assuming you have specific container elements for each world $('#world1').text(worlds[0].players); $('#world2').text(worlds[1].players); $('#world3').text(worlds[2].players); $('#world4').text(worlds[3].playesr); $('#world5').text(worlds[4].playesr); } function fetchData1() { console.log('fetchData function called'); var urla = 'https://rubinot.net/webservices/worlds.php'; $.ajax({ urla: urla, method: 'GET', dataType: 'json', success: function(data) { console.log(data); // Exibe o conteúdo no console insertPlayerWorlds(data); }, error: function(jqXHR, textStatus, errorThrown) { console.error('There has been a problem with your fetch operation:', textStatus, errorThrown); } }); } function insertPlayerWorlds1(worlds) { // Assuming you have specific container elements for each world $('#worldgringo').text(worlds[0].players); }