-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecive.html
51 lines (47 loc) · 1.93 KB
/
recive.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
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://www.gstatic.com/firebasejs/6.6.2/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/6.6.2/firebase-firestore.js"></script>
<script>
firebase.initializeApp({
apiKey: 'AIzaSyB355FvOaCYwxukfOOGdC7W-T1lQg7LCws',
authDomain: 'kokonioru-f4765.firebaseapp.com',
projectId: 'kokonioru-f4765'
});
var db = firebase.firestore();
</script>
<script>
$(function() {
function reloadData (){
$("div").empty();
db.collection("kokonioru").get().then((querySnapshot) => {
querySnapshot.forEach((doc) => {
//console.log(`${doc.id} => ${doc.data().}`);
var ido = doc.data().ido;
var keido = doc.data().keido;
var state = doc.data().state;
var text = doc.data().text;
var url = './eachUser.html?ido=' + `${ido}` + '&keido=' + `${keido}` + '&state=' + `${state}` + '&text=' + `${text}`;
$('#list').append('<a href=' + url +'>' + 'a</a><br>');
});
});
}
reloadData();
db.collection("kokonioru").onSnapshot(function(c) {
reloadData();
});
// ボタンクリックで時刻を更新
$('#btn').click(function(e) {
reloadData();
});
});
</script>
</head>
<body>
<button id="btn">更新</button>
<div id='list'>
</div>
</body>
</html>