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

129
Views
I am actually having a problem on pushing the data into the firebase rtdb

Actually the thing is that I am not able to push the realtime location of the user to the firebase rtdb and I had to make the value constant but this is really making my client disappointed, Here's the code:

firebase.initializeApp(firebaseConfig);
var database = firebase.database();
document.querySelector('#send').addEventListener('click', () => {
    var username = document.getElementById("input").value;
    var inout = document.getElementById("inout").value;
    var today = new Date();
    const monthNames = ["January", "February", "March", "April", "May", "June",
        "July", "August", "September", "October", "November", "December"
    ];
    const dateObj = new Date();
    const month = monthNames[dateObj.getMonth()];
    const day = String(dateObj.getDate()).padStart(2, '0');
    const year = dateObj.getFullYear();
    const output = day + month + year;
    var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
    var lat = 22.992344005762106;
    var lon = 88.39171958538499;
    var data = {
        name: username,
        time: time + "," + inout,
        lat: lat,
        lon: lon
    };
    var firebaseRef = firebase.database().ref('users/' + output + time);
    firebaseRef.set(data);

})
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!