-
Notifications
You must be signed in to change notification settings - Fork 2
/
script.js
52 lines (51 loc) · 1.37 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
var firebaseConfig = {
apiKey: "AIzaSyCtLv9WjKfJdOM6LQ-VBP9uOWCPdklBr0E",
authDomain: "parkit-f33d5.firebaseapp.com",
databaseURL: "https://parkit-f33d5-default-rtdb.firebaseio.com",
projectId: "parkit-f33d5",
storageBucket: "parkit-f33d5.appspot.com",
messagingSenderId: "116374492230",
appId: "1:116374492230:web:1e4dd0e5d69ab519b26647",
measurementId: "G-8T7JPSE3ET"
};
// // Initialize Firebase
firebase.initializeApp(firebaseConfig);
let slots
var dbRef = firebase.database().ref("nodemcu1")
dbRef.once("value", function (snapshot) {
var data = snapshot;
slots = data.val();
console.log(data.val());
if(slots.slot1=="0")
{
document.getElementById("slot1").innerHTML="Unavailable"
}
else
{
document.getElementById("slot1").innerHTML="Available"
}
if(slots.slot2=="0")
{
document.getElementById("slot2").innerHTML="Unavailable"
}
else
{
document.getElementById("slot2").innerHTML="Available"
}
if(slots.slot3=="0")
{
document.getElementById("slot3").innerHTML="Unavailable"
}
else
{
document.getElementById("slot3").innerHTML="Available"
}
if(slots.slot4=="0")
{
document.getElementById("slot4").innerHTML="Unavailable"
}
else
{
document.getElementById("slot4").innerHTML="Available"
}
})