MediaWiki:Timeless.js: mudanças entre as edições

De RubinOT Wiki
Sem resumo de edição
Sem resumo de edição
Linha 1: Linha 1:
// Função para fazer fetch dos dados
// Função para fazer fetch dos dados
function fetchData() {
function fetchData() {
     var url = 'https://rubinot.com.br/webservices/worlds.php';
     const url = 'https://rubinot.com.br/webservices/worlds.php';


     fetch(url)
     fetch(url)

Edição das 17h14min de 17 de maio de 2024

// Função para fazer fetch dos dados
function fetchData() {
    const url = 'https://rubinot.com.br/webservices/worlds.php';

    fetch(url)
        .then(response => {
            if (!response.ok) {
                throw new Error('Network response was not ok ' + response.statusText);
            }
            return response.json();
        })
        .then(data => {
            console.log(data); // Exibe o conteúdo no console
        })
        .catch(error => {
            console.error('There has been a problem with your fetch operation:', error);
        });
}

// Chamar a função quando o documento estiver pronto
document.addEventListener('DOMContentLoaded', fetchData);