Created
June 7, 2018 06:05
-
-
Save jmrboosties/22622c6f04087534ad32d0689633a008 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script defer src="/__/firebase/5.0.4/firebase-app.js"></script> | |
<!-- include only the Firebase features as you need --> | |
<script defer src="/__/firebase/5.0.4/firebase-functions.js"></script> | |
<!-- initialize the SDK after all desired features are loaded --> | |
<script defer src="/__/firebase/init.js"></script> | |
</head> | |
<body> | |
<!-- MY HTML IS HERE --> | |
<script> | |
function onSubmit() { | |
let json = { | |
name: document.getElementsByName("name")[0].value, | |
description: document.getElementsByName("description")[0].value | |
}; | |
let createExcerise = firebase.functions().httpsCallable('submitEntry'); | |
createExcerise(json) | |
.then(result => { | |
alert(result); | |
}) | |
.catch(error => { | |
var code = error.code; | |
var message = error.message; | |
var details = error.details; | |
alert(code + ", " + message + ", " + details); | |
}); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment