Hello World Firestore-Starter Code

Pull Hello, World from your database and display it here

by Alex Cowan

HTML

<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.3.0/firebase-app.js"></script>

<!-- TODO: Add SDKs for Firebase products that you want to use
     https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/8.3.0/firebase-analytics.js"></script>

<script>
  // Your web app's Firebase configuration
  // For Firebase JS SDK v7.20.0 and later, measurementId is optional
  var firebaseConfig = {
    apiKey: "AIzaSyBpwEPYu5jZOZZmrtBOuEu8O6oazGWBZF0",
    authDomain: "hi-class-344cf.firebaseapp.com",
    projectId: "hi-class-344cf",
    storageBucket: "hi-class-344cf.appspot.com",
    messagingSenderId: "423288074435",
    appId: "1:423288074435:web:f173a4c35a414478077276",
    measurementId: "G-1Y1CL368R2"
  };
  // Initialize Firebase
  firebase.initializeApp(firebaseConfig);
  firebase.analytics();
</script>


<h1 id='class'>

</h1>
<h2 id = 'student'>

</h2>
<h3 id ='grades'>

</h3>

<form id="add_assignment" method='post' onsubmit="return false">
  <input type="text" id="assignment" placeholder="assignment" size=30>
  <input type="text" id="grade" placeholder="grade" size=30>
  <button type='submit'>Submit</button>

</form>

JavaScript

//Reference the Code from the Managing App & User Data with Google Firebase and Firestore documentation to solve the following challenges. 



//1. Display Teacher's name, subject, and class name

//2. Display Student's Name

//3. Add Grades to Cloud Firestore Database


$('#add_assignment').submit(function() {
 add_assignment($('#grade').val(), $('#assignment').val())
})

function add_assignment(grade, assignment){
// Your code here to add assignment and grade from the database

}).then($("#add_assignment input[type=text]").val(''))
}

//4. Display grades