'how to insert data into firebase database
how to insert data into Firebase database | when i try to inset it , ncaught TypeError: firebase.database is not a function at HTMLButtonElement.document.getElementById.onclick is showing!
<body>
<script type="module">
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.0.0/firebase-app.js";
import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.0.0/firebase-analytics.js";
const firebaseConfig = {
apiKey: "AIzaSyD0rVK4xzKsfoKBW0wcurYzWiEID-3jlws",
authDomain: "web-job-app.firebaseapp.com",
databaseURL: "https://web-job-app.firebaseio.com",
projectId: "web-job-app",
storageBucket: "web-job-app.appspot.com",
messagingSenderId: "804961627520",
appId: "1:804961627520:web:d3d899152ef70588052565"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
// -------------- READY DATA ------------------//
var imageurl, title, loadUrl;
function ready() {
imageurl = document.getElementById("imageurl").value;
title = document.getElementById("title").value;
loadUrl = document.getElementById("loadUrl").value;
}
// -------------- WRITE PROSSES ------------------//
document.getElementById('btn').onclick = function () {
ready()
firebase.database().ref('theme').set({
ImageUrl: imageurl,
Title: title,
ClickUrl: loadUrl
});
}
</script>
</body>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|