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

317
Views
la función Conjunto de Firebase para insertar datos en RealTime Database no funciona en Javascript

Soy nuevo en la v9 de Firebase, así que estoy usando las nuevas funciones. Estoy tratando de insertar datos en RealTime Database of Firebase, usando SET.

PRIMERO IMPORTAR E INICIALIZAR LAS VARIABLES

 <script type="module"> // Import the functions you need from the SDKs you need const myfrom = document.getElementById("rateF"); import { initializeApp } from "https://www.gstatic.com/firebasejs/9.6.0/firebase-app.js"; import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.6.0/firebase-analytics.js"; import { getDatabase, ref, set, push } from "https://www.gstatic.com/firebasejs/9.6.0/firebase-database.js"; const firebaseConfig = { ... }; const app = initializeApp(firebaseConfig); const analytics = getAnalytics(app); const database = getDatabase(app);

Entonces empiezo la función real llamada en enviar

 myfrom.addEventListener ("submit",(e) =>validate()); function validate(){ var select = document.getElementById('titolo'); var value = select.options[select.selectedIndex].value; var comment = document.getElementById('comm').value; var radio = getValueRadio(); console.log(value); console.log(comment); console.log(radio); sendMessage(value,comment,radio); }

LA FUNCIÓN DONDE UTILIZO SET

 function sendMessage(value,comment,radio){ const db = getDatabase(); const postListRef = ref(database,"comment"); set(postListRef,{ from: "admin", film: value, comment: comment, rate: radio }) .then(()=>{ alert("Commento Inviato"); }) .catch((error)=>{ alert("error"); console.log(error) }); } function getValueRadio(){ ... } </script>

El equipo en realidad no envía ninguna alerta de ningún tipo. Las funciones simplemente comienzan y terminan sin errores, pero los datos no se insertan. Qué estoy haciendo mal ?

about 4 years ago · Juan Pablo Isaza
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!