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

566
Views
Error de referencia no detectado: base de fuego no definida en main.js

Estoy tratando de conectar Firebase a un formulario de contacto, donde se requiere que el usuario escriba y envíe el nombre completo, el correo electrónico y también el mensaje. Pero me enfrento a Uncaught ReferenceError: firebase no está definido en mi archivo main.js desde mi consola. Intenté una solución diferente pero no pude resolverlo.

Aquí está mi etiqueta de script en mi index.html

 <script type="module"> import { initializeApp } from "https://www.gstatic.com/firebasejs/9.1.3/firebase-app.js"; </script> <script src="main.js"></script>

aquí está mi código Main.js

 var config = { apiKey: "xxxxx", authDomain: "xxxxx", databaseURL: "xxxxx", projectId: "xxxxx", storageBucket: "xxxxx", messagingSenderId: "xxxxx" }; firebase.initializeApp(config); var emailRef = firebase.database().ref('emails'); // Listen for form submit document.getElementById('contactForm').addEventListener('submit', submitForm); // Submit form function submitForm(e){ e.preventDefault(); //Get values var FullName = getInputval('FullName'); var Email =getInputval('Email'); // save message saveMessage(FullName,Email); // Show alert document.querySelector('.alert').style.display = 'block'; // Hide alert after 3 seconds setTimeout(function(){ document.querySelector('.alert').style.display = 'none'; },3000); // Clear form document.getElementById('contactForm').reset(); } // Function to get form values function getInputval(id){ return document.getElementById(id).value; } // Save message to firebase function saveMessage(Fullname, Email,){ var newEmailRef = emailRef.push(); newEmailRef.set({ Fullname: Fullname, Email:Email }); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Ya que estás inicializando firebase aquí, debería ser algo como esto:

 const firebase = initializeApp(config);

Para más información puedes echar un vistazo aquí.

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!