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

310
Vistas
How To Fix Firebase Realtime Database v9 push method

I have made a HTML file test.html , but after submitting it, it doesn't show any data. Am I doing something wrong, please assist me.

Am using Firebase Realtime Database v9

CODE

<html>
    <head>
    <script type="module">
     import { initializeApp } from 'firebase/app';

  import { getDatabase } from "firebase/database";

  const firebaseConfig = {
   apiKey: "*",
   authDomain: "*.firebaseapp.com",
   databaseURL: "https://*.firebaseio.com",
   storageBucket: "*.appspot.com"
  };

  const app = initializeApp(firebaseConfig);

  const database = getDatabase(app);

  import { getDatabase, ref, push } from "firebase/database";

  function writeMessageData() {
      const db = getDatabase();
    
      set(ref(db, 'data/'), {
          name: document.getElementById("feildName").value,
          msg: document.getElementById("feildMessage").value
      });
  }
    </script>
     <title>Test</title>
    </head>
    <body>
        <input type="text" id="feildName" placeholder="Name">
        <input type="text" id="feildMessage" placeholder="Message">
        <button id="btnSubmit" onclick="writeMessageData()">SEND</button>
    </body>
</html>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

make your function async

async function writeMessageData() {
await set(ref(db,'ThePath'),{
 name: document.getElementById("feildName").value,
 msg: document.getElementById("feildMessage").value
}).then((success) => {console.log(success)}).catch((err) => {console.log(err)})
}
  1. also check the database rules which you have set.
  2. try removing the slash. change the path from "data/" to "data"

mostly it should work good luck.

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