forked from tyfal/Paradigm-X
-
Notifications
You must be signed in to change notification settings - Fork 0
/
firebase - Copy.html
81 lines (53 loc) · 1.9 KB
/
firebase - Copy.html
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="UTF-8">
<title>Firebase</title>
</head>
<body>
<div>
<form>
<input type="text" placeholder="enter name" class="form-control">
</form>
</div>
<button id="click-button">Submit</button>
<script src="https://code.jquery.com/jquery.js"></script>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/6.0.4/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/6.0.4/firebase-database.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#config-web-app -->
<script>
// Your web app's Firebase configuration
var firebaseConfig = {
apiKey: "AIzaSyBrzK7dJ0bZgystmNqv2xaOj7IwJF05sGQ",
authDomain: "hooperpedia.firebaseapp.com",
databaseURL: "https://hooperpedia.firebaseio.com",
projectId: "hooperpedia",
storageBucket: "",
messagingSenderId: "797528490036",
appId: "1:797528490036:web:231863142248d6f5"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
console.log(firebase.storage)
console.log(firebase)
var database = firebase.database();
var playerName = "";
$("#click-button").on("click", function (event) {
event.preventDefault();
playerName = $(".form-control").val().trim();
console.log(playerName)
database.ref().push({
playerName1: playerName,
});
});
database.ref().on("value", function (snapshot) {
$("#player1").text(snapshot.val().Playername);
console.log(snapshot.val())
}, function (errorObject) {
console.error(errorObject)
});
</script>
</body>
</html>