Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmrboosties/22622c6f04087534ad32d0689633a008 to your computer and use it in GitHub Desktop.
Save jmrboosties/22622c6f04087534ad32d0689633a008 to your computer and use it in GitHub Desktop.
<!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