Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

200
Visualizações
How to send the data from the script to HTML page?

I am using Firebase to get the data

code:

const admin = require('firebase-admin');
const serviceAccount = require("C:/Users/santo/Downloads/bestmpos-firebase-adminsdk.json");

admin.initializeApp({
 credential: admin.credential.cert(serviceAccount)
});

let fs = admin.firestore();
let auth = admin.auth();

const listAllUsers = async (nextPageToken) => {
  try {
    let result = await auth.listUsers(100, nextPageToken);
    result.users.forEach((userRecord) => {
      start(userRecord.toJSON())
    });
    if (result.pageToken) {
      listAllUsers(result.pageToken);
    }
  } catch(ex) {
      console.log('Exception listing users:', ex.message);
  }
}

async function first(){
    await listAllUsers();
}
first();

async function start (object){
  const info = await fs.collection('users').doc(object.uid).get();
  if (!info.exists) {
    console.log('No document');
   } else {
    console.table([info.data()]);
    document.getElementById("greeting").innerHTML = info.data().toString();

   }
} 

HTML code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
<script type="text/javascript" src="app3.js"></script>
</head>
<body>
    <p id="greeting"></p>
</body>
</html>

but I want to send data console.log(info.data()) to HTML page to simply show information,

How can I do that, I don't want to use react or any other can someone help me? and I also is this Nodejs or plain javascript?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use innerHTML to sent data in your html.

Like this:

document.getElementById("yourElementId").innerHTML = info.data();

This is working for me:

<p id="greeting">

</p>

<script>
    document.getElementById("greeting").innerHTML = "test"
</script>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda