Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!