Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

199
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda