Firebase web db help

function js(){
    console.log("Added Javascript course");
    alert("Added Javascript course")
    writeUserData(1);
    window.location = "payment.html";
}

function html(){
    console.log("Added HTML course");
    alert("Added HTML course")
    writeUserData(1);
    window.location = "payment.html";
}

function python(){
    console.log("Added Python Course");
    alert("Added Python Course")
    writeUserData(1);
    window.location = "payment.html";
}

import { initializeApp } from "https://www.gstatic.com/firebasejs/9.5.0/firebase-app.js";
import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.5.0/firebase-analytics.js";
const firebaseConfig = {
    apiKey: "AIzaSyD6_EzcFmia_xKm2OKRn5KJxF8CZoXs6ro",
    authDomain: "coding-courses-shop-1.firebaseapp.com",
    projectId: "coding-courses-shop-1",
    storageBucket: "coding-courses-shop-1.appspot.com",
    messagingSenderId: "217818989604",
    appId: "1:217818989604:web:73c71665daf99960e944b1",
    measurementId: "G-H8Z0D11C0F"
};

  // Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);

import { getDatabase } from "firebase/database";

const database = getDatabase();
import { getDatabase, ref, set } from "firebase/database";

function writeUserData(id) {
  const db = getDatabase();
  firebase.database().ref("Course Number").set({
      Coursenumber: id,
  })
}

code is this.

whenever i am running it nothing happens
https://drive.google.com/drive/folders/1JsXIotBFJRMgJC-arHbnuOLh--7mQaRL?usp=sharing

all files link
pls help

Do you have your dev tools console open? I suspect there are a few errors showing. First thing i notice? All import statements must be before any other code.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.