mardi 28 juin 2016

Highscoretable, changing firebase results in strange HTML

I´m trying to make a highscore table for a webgame with javascript and firebase. I was beginning with this:

<script language="javascript" type="text/javascript">

var scoreFireRef = new Firebase("https://webgame.firebaseio.com/scores");
scoreFireRef.on('value', function(snapshot) { 
var scName= snapshot.key();
var sc = snapshot.val();
var scScore = sc.Score;
for (var i=0; i<11; i++) {
  var rangNum=i+1;
  document.write("<tr><td>" + rangNum + ".</td>");
  document.write("<td>" + scName[i] + ".</td>");
  document.write("<td>" + scScore[i] + ".</td></tr>");

}
});

</script>

The website worked fine but the table not. So later I realized that this was the wrong path for my reference so I changed the "/scores" in my referencelink to "/users". But when I now run my webapp, I see the page for 1 second and than it´s immediately switching to an page where you can see this code when you look in the dev-tools of chrome:

  <html><head></head><body>1.u.</body></html>

So I don´t know what´s wrong. The address of that html is still my index.html-

For full code: http://pastebin.com/UYkPGY60

Thamk you for all tips/suggestions!

Aucun commentaire:

Enregistrer un commentaire