github.io/it1/bibliotek/bibliotek.js

17 lines
613 B
JavaScript
Raw Normal View History

2020-03-18 02:00:22 +00:00
var add = function() {
2020-03-26 15:10:55 +00:00
let millis = Date.parse($('#published')[0].value)
db.collection("bibliotek").add({
tittel: $('#title')[0].value,
forfatter: $('#author')[0].value,
forlag: $('#publisher')[0].value,
terningkast: $('#rating')[0].value,
2020-03-26 15:10:55 +00:00
utgitt: new firebase.firestore.Timestamp(millis/1000, 0)
}).then(function() {
2020-03-26 01:34:18 +00:00
$('#status').html('<p style="color: green;">La til bok '+$('#title')[0].value+'!</p>')
}).catch(function() {
2020-03-26 01:34:18 +00:00
$('#status').html('<p style="color: red;">Problem med å legge til bok '+$('#title')[0].value+'!</p>')
})
}
2020-03-18 02:00:22 +00:00