Displaying data from firebase databse to html table

Hello.I previously made a post and it led me to this point but I seem to be getting no where. It may be a problem of where I’m aiming in the database. Thank you in advance.


<script src="jquery-3.3.1.min.js"></script>

    <table id ="orders" style ="width:50%">
        <th>order No.</th>
body {
  font-family: "Benton Sans", "Helvetica Neue", helvetica, arial, sans-serif;
  margin: 2em;

h1 {
  font-style: italic;
  color: #373fff;

 border:2px solid black; 
 border: 1px solid black;

    var config = {
        apiKey: "*****",
        authDomain: "mycanteenapp-b0dfc.firebaseapp.com",
        databaseURL: "https://mycanteenapp-b0dfc.firebaseio.com",
        projectId: "mycanteenapp-b0dfc",
        storageBucket: "mycanteenapp-b0dfc.appspot.com",
        messagingSenderId: "18960278720"
 var database = firebase.database(MyCanteen);
    database.ref(break).once('value', function(snapshot){
            var content = '';
                var val = data.val();
                content +='<tr>';
                content += '<td>' + val.Order + '</td>';
                content += '<td>' + val.name + '</td>';
                content += '<td>' + val.orderNo + '</td>';
                content += '<td>' + val.Items + '</td>';
                content += '<td>' + val.Price + '</td>';
                content += '</tr>';

  /*var messagesRef = new Firebase('https://mycanteenapp-b0dfc.firebaseio.com"');
messagesRef.limitToLast(10).on('child_added', function (snapshot) {
    var data = snapshot.val();
    var message = data.text;

    if (message != undefined)
      messageResults.value += '\n' + message;

MOD EDIT: remove sensitive data

Hey @The-father-of-storms it would make things a little easier for the Glitch team if you could let us know what project you’re working on - that way we’d have a starting place to take a look, since none of us are that familiar with its ins and outs.

Sure the project name is: ref-project

Ok! If you look at your browser console I think you’ll see that there’s a syntax error in your javascript where you try to set your firebase database ref. I’m not sure what you’re expecting there, but the Firebase database documents seem to indicate that when setting that ref you need to identify what path from your data structure you’re hoping to read. It would probably help a lot to know what your data structure looks like, since a lot of the method calls seem to require knowledge of the structure of the data being queried.

Since there’s a syntax error in the JavaScript, none of it is actually executed, which is why you’re never seeing your console.log() output.

So would you be able to help me if I provided my json structure?

I can’t guarantee when we might be able to take a look, but I don’t know that we can offer much specific help at all without it.

You also might try some of the Firebase support forums or their Slack channels - you might find users with better and more immediate knowledge there.

I’ll try that then. Thanks for all the help!